import { RadCalendar , CalendarSelectionMode , DateRange } from "nativescript-ui-calendar" ; let _calendar ; export function onPageLoaded ( args ) { const page = args . object ; _calendar = page . getViewById ( "calendar" ) ; } export function onSingleSelectionTap ( args ) { _calendar . selectionMode = CalendarSelectionMode . Single ; let selectedDate = dateTomorrow ( ) ; _calendar . selectedDate = selectedDate ; } export function onMultipleSelectionTap ( args ) { _calendar . selectionMode = CalendarSelectionMode . Multiple ; let firstSelectedDate = dateTomorrow ( ) ; let secondSelectedDate = dateNextWeek ( ) ; _calendar . selectedDates = [ firstSelectedDate , secondSelectedDate ] ; } export function onRangeSelectionTap ( args ) { _calendar . selectionMode = CalendarSelectionMode . Range ; let firstSelectedDate = dateTomorrow ( ) ; let lastSelectedDate = dateNextWeek ( ) ; _calendar . selectedDateRange = new DateRange ( firstSelectedDate , lastSelectedDate ) ; } export function onClearSelectionTap ( args ) { _calendar . clearSelection ( ) ; } function dateTomorrow ( ) { let date = new Date ( ) ; date . setDate ( date . getDate ( ) + 1 ) ; return date ; } function dateNextWeek ( ) { let date = new Date ( ) ; date . setDate ( date . getDate ( ) + 7 ) ; return date ; }