@helpwave/hightide
Version:
helpwave's component and theming library
31 lines (29 loc) • 1.72 kB
text/typescript
declare const monthsList: readonly ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];
type Month = typeof monthsList[number];
declare const weekDayList: readonly ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
type WeekDay = typeof weekDayList[number];
declare const formatDate: (date: Date) => string;
declare const formatDateTime: (date: Date) => string;
declare const getDaysInMonth: (year: number, month: number) => number;
type Duration = {
years?: number;
months?: number;
days?: number;
hours?: number;
minutes?: number;
seconds?: number;
milliseconds?: number;
};
declare const changeDuration: (date: Date, duration: Duration, isAdding?: boolean) => Date;
declare const addDuration: (date: Date, duration: Duration) => Date;
declare const subtractDuration: (date: Date, duration: Duration) => Date;
declare const getBetweenDuration: (startDate: Date, endDate: Date) => Duration;
/** Checks if a given date is in the range of two dates
*
* An undefined value for startDate or endDate means no bound for the start or end respectively
*/
declare const isInTimeSpan: (value: Date, startDate?: Date, endDate?: Date) => boolean;
/** Compare two dates on the year, month, day */
declare const equalDate: (date1: Date, date2: Date) => boolean;
declare const getWeeksForCalenderMonth: (date: Date, weekStart: WeekDay, weeks?: number) => Date[][];
export { type Duration, type Month, type WeekDay, addDuration, changeDuration, equalDate, formatDate, formatDateTime, getBetweenDuration, getDaysInMonth, getWeeksForCalenderMonth, isInTimeSpan, monthsList, subtractDuration, weekDayList };