UNPKG

reablocks

Version:
44 lines (43 loc) 1.66 kB
/** * Get the month names for a given locale and format. * * Reference: https://www.abeautifulsite.net/posts/getting-localized-month-and-day-names-in-the-browser/ */ export declare function getMonthNames(locale?: string, format?: 'long' | 'numeric' | '2-digit' | 'short' | 'narrow'): string[]; export declare const monthNames: string[]; export declare function getDayLabels(locale?: string): string[]; export declare const daysOfWeek: string[]; export interface Day { date: Date; dayOfMonth: number; isWeekendDay: boolean; isPreviousMonth: boolean; isNextMonth: boolean; isToday: boolean; formattedDate: string; } export interface DayOptions { format: string; } export declare function getWeeks(date: Date, options?: DayOptions): Day[][]; /** * Get attributes for the day: * - isActive: if the day is within the selected range * - isRangeStart: if the day is the start of the range * - isRangeEnd: if the day is the end of the range * * "Range" here refers to a selection OR a selected date to hovered date. */ export declare function getDayAttributes(day: Date, current: Date | [Date, Date] | [Date, undefined] | [undefined, undefined] | undefined, hover: Date, isRange: boolean): { isActive: boolean; isRangeStart: boolean; isRangeEnd: boolean; }; /** * Get whether the space below the current day is empty or not */ export declare function isNextWeekEmpty(day: Date, range: [Date, Date], hideNextMonth: boolean): boolean; /** * Get whether the space above the current day is empty or not */ export declare function isPreviousWeekEmpty(day: Date, range: [Date, Date], hidePrevMonth: boolean): boolean;