@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
54 lines (53 loc) • 1.89 kB
TypeScript
/**
* Helper functions for calendar operations
*/
/**
* Get the number of days in a month
* @param year The year
* @param month The month (0-11)
* @returns Number of days in the month
*/
export declare function getDaysInMonth(year: number, month: number): number;
/**
* Get the first day of the month (0 = Sunday, 1 = Monday, etc.)
* @param year The year
* @param month The month (0-11)
* @returns The day of the week (0-6)
*/
export declare function getFirstDayOfMonth(year: number, month: number): number;
/**
* Check if two dates represent the same day
* @param date1 First date
* @param date2 Second date
* @returns Boolean indicating if dates are the same day
*/
export declare function isSameDay(date1: Date, date2: Date): boolean;
/**
* Format a date as a string
* @param date The date to format
* @param format Optional format string (defaults to ISO date)
* @returns Formatted date string
*/
export declare function formatDate(date: Date, format?: string): string;
/**
* Get month name from month index
* @param monthIndex Month index (0-11)
* @param short Whether to return short month name
* @returns Month name
*/
export declare function getMonthName(monthIndex: number, short?: boolean): string;
/**
* Get localized weekday names
* @param short Whether to get short weekday names
* @param firstDayOfWeek The first day of the week (0 = Sunday, 1 = Monday, etc.)
* @returns Array of weekday names, starting with the specified first day
*/
export declare function getWeekdayNames(short?: boolean, firstDayOfWeek?: number): string[];
/**
* Check if a date is within a range (inclusive)
* @param date The date to check
* @param minDate The minimum date
* @param maxDate The maximum date
* @returns Boolean indicating if date is within range
*/
export declare function isDateInRange(date: Date, minDate: Date | null, maxDate: Date | null): boolean;