export interface CalendarDate { day: number; month: number; selected?: boolean; siblingMonth?: boolean; weekDay?: number; weekNumber?: number; year: number; } export interface CalendarOptions { /** * Date object indicating the selected start date */ startDate?: CalendarDate | null; /** * Date object indicating the selected end date */ endDate?: CalendarDate | null; /** * Calculate dates from sibling months (before and after the current month, based on weekStart) */ siblingMonths?: boolean; /** * Calculate the week days */ weekNumbers?: boolean; /** * Day of the week to start the calendar, respects `Date.prototype.getDay` (defaults to `0`, Sunday) */ weekStart?: number; } /** * Calendar object */ declare class Calendar { startDate: CalendarDate | null; endDate: CalendarDate | null; siblingMonths: boolean; weekNumbers: boolean; weekStart: number; /** * Calendar constructor * * @param options Calendar options */ constructor({ startDate, endDate, siblingMonths, weekNumbers, weekStart, }?: CalendarOptions); /** * Calculate a calendar month * * @param year Year * @param month Month [0-11] * @return Calendar days */ getCalendar(year: number, month: number): (false | CalendarDate)[]; /** * Checks if a date is selected * * @param date Date object * @return Selected status of the date */ isDateSelected(date: CalendarDate): boolean; /** * Sets the selected period start * * @param date Date object */ setStartDate(date: CalendarDate): void; /** * Sets the selected period end * * @param date Date object */ setEndDate(date: CalendarDate): void; /** * Sets one selected date * * @param date Date object */ setDate(date: CalendarDate): void; /** * Calculates the difference between two dates (date1 - date2), in days * * @param dateLeft Date object * @param dateRight Date object * @return Days between the dates */ static diff(dateLeft: CalendarDate, dateRight: CalendarDate): number; /** * Calculates the interval between two dates * * @param dateLeft Date object * @param dateRight Date object * @return Number of days between dates */ static interval(dateLeft: CalendarDate, dateRight: CalendarDate): number; /** * Quickly compare two dates * * @param dateLeft Left `CalendarDate` object * @param dateRight Right `CalendarDate` object * @return Comparison result: -1 (left < right), 0 (equal) or 1 (left > right) */ static compare(dateLeft: CalendarDate, dateRight: CalendarDate): 0 | 1 | -1; /** * Calculates the number of days in a month * * @param year Year * @param month Month [0-11] * @return Length of the month */ static daysInMonth(year: number, month: number): number; /** * Calculates if a given year is a leap year * * @param year Year * @return Leap year or not */ static isLeapYear(year: number): boolean; /** * Calculates the week number for a given date * * @param date Date object * @return Week number */ static calculateWeekNumber(date: CalendarDate): number; } /** * Exports the Calendar */ export { Calendar }; //# sourceMappingURL=index.d.ts.map