export interface IRawDate { year?: number; month?: number; day?: number; hour?: number; minute?: number; second?: number; millisecond?: number; timezoneOffset?: number; dateHash?: string; timeHash?: string; date?: number; changed?: boolean; } export type TDateLocale = { days: string[]; daysShort: string[]; months: string[]; monthsLong: string[]; monthsShort: string[]; today: string; firstDayOfWeek: number; format24h: boolean; pluralDay: (day?: number) => string; }; /** * Format date by mask * @param value * @param mask * @param dateLocale * @param __forcedYear * @param __forcedTimezoneOffset */ export declare function formatDate(value: any, mask: string, dateLocale?: TDateLocale, __forcedYear?: number, __forcedTimezoneOffset?: number): string | undefined; /** * Set a specific year, month and day to a date. * @param date * @param rawModified * @param utc */ export declare function adjustDate(date: Date, rawModified: IRawDate, utc?: boolean): Date; /** * Parse any string into a date object based on the format passed. * @param str * @param mask * @param dateLocale */ export declare function extractDate(str: string, mask: string, dateLocale?: TDateLocale): Date; /** * Split date by mask. * @param str * @param mask * @param dateLocale * @param defaultModel */ export declare function splitDate(str?: string | any, mask?: string, dateLocale?: TDateLocale, defaultModel?: IRawDate): IRawDate; /** * Check a date string for validity. * @param date */ export declare function isValidDate(date: any): boolean; /** * The following method is just a wrapper to help you in cases where you just need current time but with a different year, or month, or second etc. * @param modified * @param utc */ export declare function buildDate(modified: IRawDate, utc?: boolean): Date; /** * Get the day number in week for a given date. * @param date */ export declare function getDayOfWeek(date: Date): number; /** * Get the week number in year for a given date. * @param date */ export declare function getWeekOfYear(date: Date): number; /** * Get the day of the year from a given date. * @param date */ export declare function getDayOfYear(date: Date): number | undefined; /** * Check a date is in a given date/time range. * @param date * @param from * @param to * @param opts */ export declare function isBetweenDates(date: Date, from: Date, to: Date, opts?: { onlyDate?: boolean; inclusiveFrom?: boolean; inclusiveTo?: boolean; }): boolean; /** * Add a given date/time unit from a given date. * @param date * @param modified */ export declare function addToDate(date: Date, modified: IRawDate): Date; /** * Subtract a given date/time unit from a given date. * @param date * @param modified */ export declare function subtractFromDate(date: Date, modified: IRawDate): Date; /** * Beginning of a given date/time unit for a given date. * @param date * @param unit * @param utc */ export declare function startOfDate(date: Date, unit: string, utc?: boolean): Date; /** * End of a given date/time unit for a given date. * @param date * @param unit * @param utc */ export declare function endOfDate(date: Date, unit: string, utc: boolean): Date; /** * Get the maximum date from a given date and other dates. * @param date * @param args */ export declare function getMaxDate(date: Date, ...args: Date[]): Date; /** * Get the minimum date from a given date and other dates. * @param date * @param args */ export declare function getMinDate(date: Date, ...args: Date[]): Date; /** * Get the difference between two dates. * @param date * @param subtract * @param unit */ export declare function getDateDiff(date: Date, subtract: Date, unit?: string): number; /** * Get date format * @param date */ export declare function inferDateFormat(date: Date | any): 'date' | 'number' | 'string'; /** * Normalize a date in a given date/time range. * @param date * @param min * @param max */ export declare function getDateBetween(date: Date, min: Date, max: Date): Date; /** * Check of two dates unit are equal. * @param date1 * @param date2 * @param unit */ export declare function isSameDate(date1: Date, date2: Date, unit: string): boolean; /** * Get the number of days in a month. * @param date */ export declare function daysInMonth(date: Date): number; /** * Cloning date object. * @param date */ export declare function cloneDate(date: Date): Date; declare const _default: { formatDate: typeof formatDate; cloneDate: typeof cloneDate; isValidDate: typeof isValidDate; buildDate: typeof buildDate; getDayOfWeek: typeof getDayOfWeek; getWeekOfYear: typeof getWeekOfYear; isBetweenDates: typeof isBetweenDates; addToDate: typeof addToDate; subtractFromDate: typeof subtractFromDate; adjustDate: typeof adjustDate; startOfDate: typeof startOfDate; endOfDate: typeof endOfDate; getMaxDate: typeof getMaxDate; getMinDate: typeof getMinDate; getDateDiff: typeof getDateDiff; getDayOfYear: typeof getDayOfYear; inferDateFormat: typeof inferDateFormat; getDateBetween: typeof getDateBetween; isSameDate: typeof isSameDate; daysInMonth: typeof daysInMonth; }; export default _default;