react-ultimate-calendar
Version:
A lightweight calendar for React application.
35 lines (34 loc) • 2.07 kB
TypeScript
export declare const getEndOfWeek: (_date: Date, weekStartsOn?: 0 | 1 | 6) => Date;
export declare const getStartOfWeek: (_date: Date, weekStartsOn?: 0 | 1 | 6) => Date;
export declare const getStartOfFirstWeekOfTheYear: (_date: Date, weekStartsOn?: 0 | 1 | 6) => Date;
/**
* Locale determines the first day of week (0 - Sunday, 1 - Monday, ..., 6 - Saturday).
* Three settings for the first day of week are most used around the world:
* - ISO-8601: Europe uses Monday (1)
* - US, Canada uses Sunday (0)
* - Most of Arab countries use Saturday (6)
*
* @param {String} locale The currently active locale.
* @returns {Number} The week day number
*/
export declare const getFirstDayOfWeek: (locale: string) => 0 | 1 | 6;
/**
* Returns the beginning and end date of the given week number.
*
* @param {Number} weekNumber The week number of a year (0 - 53)
* @param {Number} year Full year in which the week occurs.
* @param {Number} weekStartsOn Weeks starting on (1) Monday - ISO-8601, (0) Sunday - US, Canada
* or (6) Saturday - Islamic countries
* @returns {Date[]} The beginning and the end of given week.
*/
export declare const getDateRangeOfWeek: (weekNumber: number, year: number, weekStartsOn?: 0 | 1 | 6) => Date[];
export declare const getWeekNumber: (_date: Date, weekStartsOn?: 0 | 1 | 6) => number;
export declare const getWeekDays: (locale: string) => string[];
export declare const getMonthName: (month: number, locale: string) => string;
/**
* Returns the number of days in a given month.
*/
export declare const numDaysInMonth: (_date: Date) => number;
export declare const isAfterDate: (date: Date | null, day: number, month: number, year: number, hour?: number, minute?: number, second?: number) => boolean;
export declare const isBeforeDate: (date: Date | null, day: number, month: number, year: number, hour?: number, minute?: number, second?: number) => boolean;
export declare const isSameDay: (date: Date | null, day: number, month: number, year: number) => boolean;