@uplink-protocol/calendar-controller
Version:
Flexible calendar and time picker API supporting both calendar, date-picker, and time-picker integrations for any JavaScript framework or library
60 lines (59 loc) • 1.46 kB
TypeScript
/**
* Date selection service interface
* Responsible for handling date selection and ranges
*/
export interface IDateSelectionService {
/**
* Select a single date
*/
selectDate(date: Date): Date;
/**
* Select a date for a range
*/
selectDateRange(date: Date, currentRange: {
startDate: Date | null;
endDate: Date | null;
}): {
startDate: Date | null;
endDate: Date | null;
};
/**
* Clear the current selection
*/
clearSelection(isRangeMode: boolean): {
selectedDate: Date | null;
selectedDateRange: {
startDate: Date | null;
endDate: Date | null;
};
};
/**
* Check if a given date is selected
*/
isDateSelected(date: Date, selectedDate: Date | null): boolean;
/**
* Check if a given date is in the selected range
*/
isDateInRange(date: Date, range: {
startDate: Date | null;
endDate: Date | null;
}): {
isInRange: boolean;
isRangeStart: boolean;
isRangeEnd: boolean;
};
/**
* Clear the date range selection
*/
clearDateRange(): {
startDate: Date | null;
endDate: Date | null;
};
/**
* Check if a date is in the selected range (simplified version)
*/
isDateInSelectedRange(date: Date, range: {
startDate: Date | null;
endDate: Date | null;
}): boolean;
}