@quasar/quasar-ui-qcalendar
Version:
QCalendar - Day/Month/Week Calendars, Popups, Date Pickers, Schedules, Agendas, Planners and Tasks for your Vue Apps
645 lines (644 loc) • 31 kB
TypeScript
export declare const PARSE_DATETIME: RegExp;
export declare const PARSE_DATE: RegExp;
export declare const PARSE_TIME: RegExp;
export declare const DAYS_IN_MONTH: number[];
export declare const DAYS_IN_MONTH_LEAP: number[];
export declare const TIME_CONSTANTS: {
MILLISECONDS_IN: {
SECOND: number;
MINUTE: number;
HOUR: number;
DAY: number;
WEEK: number;
};
SECONDS_IN: {
MINUTE: number;
HOUR: number;
DAY: number;
WEEK: number;
};
MINUTES_IN: {
MINUTE: number;
HOUR: number;
DAY: number;
WEEK: number;
};
HOURS_IN: {
DAY: number;
WEEK: number;
};
DAYS_IN: {
WEEK: number;
};
};
export declare const DAYS_IN_MONTH_MIN = 28;
export declare const DAYS_IN_MONTH_MAX = 31;
export declare const MONTH_MAX = 12;
export declare const MONTH_MIN = 1;
export declare const DAY_MIN = 1;
export declare const FIRST_HOUR = 0;
/**
* @typedef {Object} Timestamp The Timestamp object
* @property {string=} Timestamp.date Date string in format 'YYYY-MM-DD'
* @property {string=} Timestamp.time Time string in format 'HH:MM'
* @property {number} Timestamp.year The numeric year
* @property {number} Timestamp.month The numeric month (Jan = 1, ...)
* @property {number} Timestamp.day The numeric day
* @property {number} Timestamp.weekday The numeric weekday (Sun = 0, ..., Sat = 6)
* @property {number=} Timestamp.hour The numeric hour
* @property {number} Timestamp.minute The numeric minute
* @property {number=} Timestamp.doy The numeric day of the year (doy)
* @property {number=} Timestamp.workweek The numeric workweek
* @property {boolean} Timestamp.hasDay True if Timestamp.date is filled in and usable
* @property {boolean} Timestamp.hasTime True if Timestamp.time is filled in and usable
* @property {boolean=} Timestamp.past True if the Timestamp is in the past
* @property {boolean=} Timestamp.current True if Timestamp is current day (now)
* @property {boolean=} Timestamp.future True if Timestamp is in the future
* @property {boolean=} Timestamp.disabled True if this is a disabled date
* @property {boolean=} Timestamp.currentWeekday True if this date corresponds to current weekday
*/
export interface Timestamp {
date: string;
hasDay: boolean;
year: number;
month: number;
day: number;
time?: string;
hasTime: boolean;
hour: number;
minute: number;
weekday?: number;
doy?: number;
workweek?: number;
past?: boolean;
current?: boolean;
future?: boolean;
disabled?: boolean;
currentWeekday?: boolean;
}
export interface TimeObject {
hour: number;
minute: number;
}
/**
* Validates the passed input ('YYY-MM-DD') as a date or ('YYY-MM-DD HH:MM') date time combination
* @param {string} input A string in the form 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM'
* @returns {boolean} True if parseable
*/
export declare function validateTimestamp(input: string): boolean;
/**
* Fast low-level parser for a date string ('YYYY-MM-DD'). Does not update formatted or relative date.
* Use 'parseTimestamp' for formatted and relative updates
* @param {string} input In the form 'YYYY-MM-DD hh:mm:ss' (seconds are optional, but not used)
* @returns {Timestamp} This {@link Timestamp} is minimally filled in. The {@link Timestamp.date} and {@link Timestamp.time} as well as relative data will not be filled in.
*/
export declare function parsed(input: string): Timestamp | null;
/**
* Takes a JavaScript Date and returns a {@link Timestamp}. The {@link Timestamp} is not updated with relative information.
* @param {Date} date JavaScript Date
* @param {boolean} utc If set the {@link Timestamp} will parse the Date as UTC
* @returns {Timestamp} A minimal {@link Timestamp} without updated or relative updates.
*/
export declare function parseDate(date: Date, utc?: boolean): Timestamp | null;
/**
* Padds a passed in number to length (converts to a string). Good for converting '5' as '05'.
* @param {number} x The number to pad
* @param {number} length The length of the required number as a string
* @returns {string} The padded number (as a string). (ie: 5 = '05')
*/
export declare function padNumber(x: number, length: number): string;
/**
* Returns if the passed year is a leap year
* @param {number} year The year to check (ie: 1999, 2020)
* @returns {boolean} True if the year is a leap year
*/
export declare function isLeapYear(year: number): boolean;
/**
* Returns the days of the specified month in a year
* @param {number} year The year (ie: 1999, 2020)
* @param {number} month The month (zero-based)
* @returns {number} The number of days in the month (corrected for leap years)
*/
export declare function daysInMonth(year: number, month: number): number;
/**
* Returns a {@link Timestamp} of next day from passed in {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {Timestamp} The modified {@link Timestamp} as the next day
*/
export declare function nextDay(timestamp: Timestamp): Timestamp;
/**
* Returns a {@link Timestamp} of previous day from passed in {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {Timestamp} The modified {@link Timestamp} as the previous day
*/
export declare function prevDay(timestamp: Timestamp): Timestamp;
/**
* Returns today's date
* @returns {string} Date string in the form 'YYYY-MM-dd'
*/
export declare function today(): string;
/**
* Takes a date string ('YYYY-MM-DD') and validates if it is today's date
* @param {string} date Date string in the form 'YYYY-MM-DD'
* @returns {boolean} True if the date is today's date
*/
export declare function isToday(date: string): boolean;
/**
* Returns the start of the week give a {@link Timestamp} and weekdays (in which it finds the day representing the start of the week).
* If today {@link Timestamp} is passed in then this is used to update relative information in the returned {@link Timestamp}.
* @param {Timestamp} timestamp The {@link Timestamp} to use to find the start of the week
* @param {number[]} weekdays The array is [0,1,2,3,4,5,6] where 0=Sunday and 6=Saturday
* @param {Timestamp=} today If passed in then the {@link Timestamp} is updated with relative information
* @returns {Timestamp} The {@link Timestamp} representing the start of the week
*/
export declare function getStartOfWeek(timestamp: Timestamp, weekdays: number[], today: Timestamp): Timestamp;
/**
* Returns the end of the week give a {@link Timestamp} and weekdays (in which it finds the day representing the last of the week).
* If today {@link Timestamp} is passed in then this is used to update relative information in the returned {@link Timestamp}.
* @param {Timestamp} timestamp The {@link Timestamp} to use to find the end of the week
* @param {number[]} weekdays The array is [0,1,2,3,4,5,6] where 0=Sunday and 6=Saturday
* @param {Timestamp=} today If passed in then the {@link Timestamp} is updated with relative information
* @returns {Timestamp} The {@link Timestamp} representing the end of the week
*/
export declare function getEndOfWeek(timestamp: Timestamp, weekdays: number[], today: Timestamp): Timestamp;
/**
* Finds the start of the month based on the passed in {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use to find the start of the month
* @returns {Timestamp} A {@link Timestamp} of the start of the month
*/
export declare function getStartOfMonth(timestamp: Timestamp): Timestamp;
/**
* Finds the end of the month based on the passed in {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use to find the end of the month
* @returns {Timestamp} A {@link Timestamp} of the end of the month
*/
export declare function getEndOfMonth(timestamp: Timestamp): Timestamp;
export declare function parseTime(input: number | string | {
hour: number;
minute: number;
}): number | false;
/**
* Compares two {@link Timestamp}s for exactness
* @param {Timestamp} ts1 The first {@link Timestamp}
* @param {Timestamp} ts2 The second {@link Timestamp}
* @returns {boolean} True if the two {@link Timestamp}s are an exact match
*/
export declare function compareTimestamps(ts1: Timestamp, ts2: Timestamp): boolean;
/**
* Compares the date of two {@link Timestamp}s that have been updated with relative data
* @param {Timestamp} ts1 The first {@link Timestamp}
* @param {Timestamp} ts2 The second {@link Timestamp}
* @returns {boolean} True if the two dates are the same
*/
export declare function compareDate(ts1: Timestamp, ts2: Timestamp): boolean;
/**
* Compares the time of two {@link Timestamp}s that have been updated with relative data
* @param {Timestamp} ts1 The first {@link Timestamp}
* @param {Timestamp} ts2 The second {@link Timestamp}
* @returns {boolean} True if the two times are an exact match
*/
export declare function compareTime(ts1: Timestamp, ts2: Timestamp): boolean;
/**
* Compares the date and time of two {@link Timestamp}s that have been updated with relative data
* @param {Timestamp} ts1 The first {@link Timestamp}
* @param {Timestamp} ts2 The second {@link Timestamp}
* @returns {boolean} True if the date and time are an exact match
*/
export declare function compareDateTime(ts1: Timestamp, ts2: Timestamp): boolean;
/**
* High-level parser that converts the passed in string to {@link Timestamp} and uses 'now' to update relative information.
* @param {string} input In the form 'YYYY-MM-DD hh:mm:ss' (seconds are optional, but not used)
* @param {Timestamp} now A {@link Timestamp} to use for relative data updates
* @returns {Timestamp} The {@link Timestamp.date} will be filled in as well as the {@link Timestamp.time} if a time is supplied and formatted fields (doy, weekday, workweek, etc). If 'now' is supplied, then relative data will also be updated.
*/
export declare function parseTimestamp(input: string, now?: Timestamp | null): Timestamp | null;
/**
* Converts a {@link Timestamp} into a numeric date identifier based on the passed {@link Timestamp}'s date
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {number} The numeric date identifier
*/
export declare function getDayIdentifier(timestamp: Timestamp): number;
/**
* Converts a {@link Timestamp} into a numeric time identifier based on the passed {@link Timestamp}'s time
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {number} The numeric time identifier
*/
export declare function getTimeIdentifier(timestamp: Timestamp): number;
/**
* Converts a {@link Timestamp} into a numeric date and time identifier based on the passed {@link Timestamp}'s date and time
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {number} The numeric date+time identifier
*/
export declare function getDayTimeIdentifier(timestamp: Timestamp): number;
/**
* Returns the difference between two {@link Timestamp}s
* @param {Timestamp} ts1 The first {@link Timestamp}
* @param {Timestamp} ts2 The second {@link Timestamp}
* @param {boolean=} strict Optional flag to not to return negative numbers
* @returns {number} The difference
*/
export declare function diffTimestamp(ts1: Timestamp, ts2: Timestamp, strict?: boolean): number;
/**
* Updates a {@link Timestamp} with relative data (past, current and future)
* @param {Timestamp} timestamp The {@link Timestamp} that needs relative data updated
* @param {Timestamp} now {@link Timestamp} that represents the current date (optional time)
* @param {boolean=} time Optional flag to include time ('timestamp' and 'now' params should have time values)
* @returns {Timestamp} A new {@link Timestamp}
*/
export declare function updateRelative(timestamp: Timestamp, now: Timestamp, time?: boolean): Timestamp;
/**
* Sets a Timestamp{@link Timestamp} to number of minutes past midnight (modifies hour and minutes if needed)
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @param {number} minutes The number of minutes to set from midnight
* @param {Timestamp=} now Optional {@link Timestamp} representing current date and time
* @returns {Timestamp} A new {@link Timestamp}
*/
export declare function updateMinutes(timestamp: Timestamp, minutes: number, now?: Timestamp | null): Timestamp;
/**
* Updates the {@link Timestamp} with the weekday
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @returns A new Timestamp
*/
export declare function updateWeekday(timestamp: Timestamp): Timestamp;
/**
* Updates the {@link Timestamp} with the day of the year (doy)
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @returns A new Timestamp
*/
export declare function updateDayOfYear(timestamp: Timestamp): Timestamp;
/**
* Updates the {@link Timestamp} with the workweek
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @returns A new {@link Timestamp}
*/
export declare function updateWorkWeek(timestamp: Timestamp): Timestamp;
/**
* Updates the passed {@link Timestamp} with disabled, if needed
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @param {string} [disabledBefore] In 'YYY-MM-DD' format
* @param {string} [disabledAfter] In 'YYY-MM-DD' format
* @param {number[]} [disabledWeekdays] An array of numbers representing weekdays [0 = Sun, ..., 6 = Sat]
* @param {string[]|string[][]} [disabledDays] An array of days in 'YYYY-MM-DD' format. If an array with a pair of dates is in first array, then this is treated as a range.
* @returns A new {@link Timestamp}
*/
export declare function updateDisabled(timestamp: Timestamp, disabledBefore?: string, disabledAfter?: string, disabledWeekdays?: number[], disabledDays?: string[] | string[][]): Timestamp;
/**
* Updates the passed {@link Timestamp} with formatted data (time string, date string, weekday, day of year and workweek)
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @returns A new {@link Timestamp}
*/
export declare function updateFormatted(timestamp: Timestamp): Timestamp;
/**
* Returns day of the year (doy) for the passed in {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {number} The day of the year
*/
export declare function getDayOfYear(timestamp: Timestamp): number | void;
/**
* Returns workweek for the passed in {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {number} The work week
*/
export declare function getWorkWeek(timestamp: Timestamp): number;
/**
* Returns weekday for the passed in {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @returns {number} The weekday
*/
export declare function getWeekday(timestamp: Timestamp): number;
/**
* Makes a copy of the passed in {@link Timestamp}
* @param {Timestamp} timestamp The original {@link Timestamp}
* @returns {Timestamp} A copy of the original {@link Timestamp}
*/
export declare function copyTimestamp(timestamp: Timestamp): Timestamp;
/**
* Used internally to convert {@link Timestamp} used with 'parsed' or 'parseDate' so the 'date' portion of the {@link Timestamp} is correct.
* @param {Timestamp} timestamp The (raw) {@link Timestamp}
* @returns {string} A formatted date ('YYYY-MM-DD')
*/
export declare function getDate(timestamp: Timestamp): string;
/**
* Used intenally to convert {@link Timestamp} with 'parsed' or 'parseDate' so the 'time' portion of the {@link Timestamp} is correct.
* @param {Timestamp} timestamp The (raw) {@link Timestamp}
* @returns {string} A formatted time ('hh:mm')
*/
export declare function getTime(timestamp: Timestamp): string;
/**
* Returns a formatted string date and time ('YYYY-YY-MM hh:mm')
* @param {Timestamp} timestamp The {@link Timestamp}
* @returns {string} A formatted date time ('YYYY-MM-DD HH:mm')
*/
export declare function getDateTime(timestamp: Timestamp): string;
/**
* An alias for {relativeDays}
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @param {function} [mover=nextDay] The mover function to use (ie: {nextDay} or {prevDay}).
* @param {number} [days=1] The number of days to move.
* @param {number[]} [allowedWeekdays=[ 0, 1, 2, 3, 4, 5, 6 ]] An array of numbers representing the weekdays. ie: [0 = Sun, ..., 6 = Sat].
* @returns The modified {@link Timestamp}
*/
export declare function moveRelativeDays(timestamp: Timestamp, mover?: typeof nextDay, days?: number, allowedWeekdays?: number[]): Timestamp;
/**
* Moves the {@link Timestamp} the number of relative days
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @param {function} [mover=nextDay] The mover function to use (ie: {nextDay} or {prevDay}).
* @param {number} [days=1] The number of days to move.
* @param {number[]} [allowedWeekdays=[ 0, 1, 2, 3, 4, 5, 6 ]] An array of numbers representing the weekdays. ie: [0 = Sun, ..., 6 = Sat].
* @returns A new {@link Timestamp}
*/
export declare function relativeDays(timestamp: Timestamp, mover?: typeof nextDay, days?: number, allowedWeekdays?: number[]): Timestamp;
/**
* Finds the specified weekday (forward or back) based on the {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to modify
* @param {number} weekday The weekday number (Sun = 0, ..., Sat = 6)
* @param {function} [mover=nextDay] The function to use ({prevDay} or {nextDay}).
* @param {number} [maxDays=6] The number of days to look forward or back.
* @returns A new {@link Timestamp}
*/
export declare function findWeekday(timestamp: Timestamp, weekday: number, mover?: typeof nextDay, maxDays?: number): Timestamp;
/**
* Creates an array of {@link Timestamp}s based on start and end params
* @param {Timestamp} start The starting {@link Timestamp}
* @param {Timestamp} end The ending {@link Timestamp}
* @param {Timestamp} now The relative day
* @param {number[]} weekdays An array of numbers (representing days of the week) that are 0 (=Sunday) to 6 (=Saturday)
* @param {string} [disabledBefore] Days before this date are disabled (YYYY-MM-DD)
* @param {string} [disabledAfter] Days after this date are disabled (YYYY-MM-DD)
* @param {number[]} [disabledWeekdays] An array representing weekdays that are disabled [0 = Sun, ..., 6 = Sat]
* @param {string[]} [disabledDays] An array of days in 'YYYY-MM-DD' format. If an array with a pair of dates is in first array, then this is treated as a range.
* @param {number} [max=42] Max days to do
* @param {number} [min=0] Min days to do
* @returns {Timestamp[]} The requested array of {@link Timestamp}s
*/
export declare function createDayList(start: Timestamp, end: Timestamp, now: Timestamp, weekdays?: number[], disabledBefore?: string | undefined, disabledAfter?: string | undefined, disabledWeekdays?: number[], disabledDays?: string[], max?: number, min?: number): Timestamp[];
/**
* Creates an array of interval {@link Timestamp}s based on params
* @param {Timestamp} timestamp The starting {@link Timestamp}
* @param {number} first The starting interval time
* @param {number} minutes How many minutes between intervals (ie: 60, 30, 15 would be common ones)
* @param {number} count The number of intervals needed
* @param {Timestamp} now A relative {@link Timestamp} with time
* @returns {Timestamp[]} The requested array of interval {@link Timestamp}s
*/
export declare function createIntervalList(timestamp: Timestamp, first: number, minutes: number, count: number, now: Timestamp): Timestamp[];
export type LocaleFormatter = (_timestamp: Timestamp, _short: boolean) => Intl.DateTimeFormatOptions;
export type WeekdayFormatter = (_weekday: keyof typeof weekdayDateMap, _type: string, _locale?: string) => string;
export type MonthFormatter = (_month: number, _type: string, _locale?: string) => string;
/**
* @callback getOptions
* @param {Timestamp} timestamp A {@link Timestamp} object
* @param {boolean} short True if using short options
* @returns {Object} An Intl object representing optioons to be used
*/
/**
* @callback formatter
* @param {Timestamp} timestamp The {@link Timestamp} being used
* @param {boolean} short If short format is being requested
* @returns {string} The localized string of the formatted {@link Timestamp}
*/
/**
* Returns a function that uses Intl.DateTimeFormat formatting
* @param {string} locale The locale to use (ie: en-US)
* @param {getOptions} cb The function to call for options. This function should return an Intl formatted object. The function is passed (timestamp, short).
* @returns {formatter} The function has params (timestamp, short). The short is to use the short options.
*/
export declare function createNativeLocaleFormatter(locale: string, cb: LocaleFormatter): (_timestamp: Timestamp, _short: boolean) => string;
/**
* Makes a JavaScript Date from the passed {@link Timestamp}
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @param {boolean} utc True to get Date object using UTC
* @returns {Date} A JavaScript Date
*/
export declare function makeDate(timestamp: Timestamp, utc?: boolean): Date;
/**
* Makes a JavaScript Date from the passed {@link Timestamp} (with time)
* @param {Timestamp} timestamp The {@link Timestamp} to use
* @param {boolean} utc True to get Date object using UTC
* @returns {Date} A JavaScript Date
*/
export declare function makeDateTime(timestamp: Timestamp, utc?: boolean): Date;
/**
* Validates if the input is a finite number.
*
* @param input - The value to be validated. Can be a string or a number.
* @returns A boolean indicating whether the input is a finite number.
* Returns true if the input is a finite number, false otherwise.
*/
export declare function validateNumber(input: string | number): boolean;
/**
* Given an array of {@link Timestamp}s, finds the max date (and possible time)
* @param {Timestamp[]} timestamps This is an array of {@link Timestamp}s
* @param {boolean=} useTime Default false; if true, uses time in the comparison as well
* @returns The {@link Timestamp} with the highest date (and possibly time) value
*/
export declare function maxTimestamp(timestamps: Timestamp[], useTime?: boolean): Timestamp;
/**
* Given an array of {@link Timestamp}s, finds the min date (and possible time)
* @param {Timestamp[]} timestamps This is an array of {@link Timestamp}s
* @param {boolean=} useTime Default false; if true, uses time in the comparison as well
* @returns The {@link Timestamp} with the lowest date (and possibly time) value
*/
export declare function minTimestamp(timestamps: Timestamp[], useTime?: boolean): Timestamp;
/**
* Determines if the passed {@link Timestamp} is between (or equal) to two {@link Timestamp}s (range)
* @param {Timestamp} timestamp The {@link Timestamp} for testing
* @param {Timestamp} startTimestamp The starting {@link Timestamp}
* @param {Timestamp} endTimestamp The ending {@link Timestamp}
* @param {boolean=} useTime If true, use time from the {@link Timestamp}s
* @returns {boolean} True if {@link Timestamp} is between (or equal) to two {@link Timestamp}s (range)
*/
export declare function isBetweenDates(timestamp: Timestamp, startTimestamp: Timestamp, endTimestamp: Timestamp, useTime?: boolean): boolean;
/**
* Determine if two ranges of {@link Timestamp}s overlap each other
* @param {Timestamp} startTimestamp The starting {@link Timestamp} of first range
* @param {Timestamp} endTimestamp The endinging {@link Timestamp} of first range
* @param {Timestamp} firstTimestamp The starting {@link Timestamp} of second range
* @param {Timestamp} lastTimestamp The ending {@link Timestamp} of second range
* @returns {boolean} True if the two ranges overlap each other
*/
export declare function isOverlappingDates(startTimestamp: Timestamp, endTimestamp: Timestamp, firstTimestamp: Timestamp, lastTimestamp: Timestamp): boolean;
export interface AddToDateOptions {
year?: number;
month?: number;
day?: number;
hour?: number;
minute?: number;
}
/**
* Add or decrements years, months, days, hours or minutes to a timestamp
* @param {Timestamp} timestamp The {@link Timestamp} object
* @param {Object} options configuration data
* @param {number=} options.year If positive, adds years. If negative, removes years.
* @param {number=} options.month If positive, adds months. If negative, removes month.
* @param {number=} options.day If positive, adds days. If negative, removes days.
* @param {number=} options.hour If positive, adds hours. If negative, removes hours.
* @param {number=} options.minute If positive, adds minutes. If negative, removes minutes.
* @returns {Timestamp} A modified copy of the passed in {@link Timestamp}
*/
export declare function addToDate(timestamp: Timestamp, options: AddToDateOptions): Timestamp;
/**
* Returns number of days between two {@link Timestamp}s
* @param {Timestamp} ts1 The first {@link Timestamp}
* @param {Timestamp} ts2 The second {@link Timestamp}
* @returns Number of days
*/
export declare function daysBetween(ts1: Timestamp, ts2: Timestamp): number;
/**
* Returns number of weeks between two {@link Timestamp}s
* @param {Timestamp} ts1 The first {@link Timestamp}
* @param {Timestamp} ts2 The second {@link Timestamp}
*/
export declare function weeksBetween(ts1: Timestamp, ts2: Timestamp): number;
declare const weekdayDateMap: {
Sun: Date;
Mon: Date;
Tue: Date;
Wed: Date;
Thu: Date;
Fri: Date;
Sat: Date;
};
/**
* Returns a function that uses Intl.DateTimeFormat to format weekdays.
*
* @function getWeekdayFormatter
* @returns {function} A function that formats weekdays.
*
* @example
* const formatWeekday = getWeekdayFormatter();
* console.log(formatWeekday('Mon', 'long', 'en-US')); // "Monday"
* console.log(formatWeekday('Mon', 'short', 'fr-FR')); // "lun."
*
* @param {string} weekday - The abbreviation of the weekday (e.g., 'Mon', 'Tue', 'Wed', etc.).
* @param {string} [type='long'] - The type of formatting to use ('narrow', 'short', or 'long').
* @param {string} [locale=''] - The locale to use for formatting.
*
* @returns {string} The formatted weekday.
*/
export declare function getWeekdayFormatter(): WeekdayFormatter;
/**
* Retrieves an array of localized weekday names.
*
* @param {string} type - The format type for the weekday names. Can be 'narrow', 'short', or 'long'.
* @param {string} [locale] - The locale to use for formatting. If not provided, the default locale is used.
* @returns {string[]} An array of localized weekday names in the specified format.
*/
export declare function getWeekdayNames(type: string, locale: string): string[];
/**
* Creates and returns a function for formatting month names based on locale and format type.
*
* @returns {Function} A function that formats month names.
* The returned function accepts the following parameters:
* @param {number} month - The month to format (0-11, where 0 is January).
* @param {string} [type='long'] - The format type: 'narrow', 'short', or 'long'.
* @param {string} [locale] - The locale to use for formatting. If not provided, the default locale is used.
* @returns {string} The formatted month name.
*
* @throws {Error} If Intl or Intl.DateTimeFormat is not supported in the environment.
*/
export declare function getMonthFormatter(): MonthFormatter;
/**
* Retrieves an array of localized month names.
*
* @param {string} type - The format type for the month names. Can be 'narrow', 'short', or 'long'.
* @param {string} [locale] - The locale to use for formatting. If not provided, the default locale is used.
* @returns {string[]} An array of localized month names in the specified format.
*/
export declare function getMonthNames(type: string, locale: string): string[];
declare const _default: {
PARSE_DATETIME: RegExp;
PARSE_DATE: RegExp;
PARSE_TIME: RegExp;
DAYS_IN_MONTH: number[];
DAYS_IN_MONTH_LEAP: number[];
DAYS_IN_MONTH_MIN: number;
DAYS_IN_MONTH_MAX: number;
MONTH_MAX: number;
MONTH_MIN: number;
DAY_MIN: number;
TIME_CONSTANTS: {
MILLISECONDS_IN: {
SECOND: number;
MINUTE: number;
HOUR: number;
DAY: number;
WEEK: number;
};
SECONDS_IN: {
MINUTE: number;
HOUR: number;
DAY: number;
WEEK: number;
};
MINUTES_IN: {
MINUTE: number;
HOUR: number;
DAY: number;
WEEK: number;
};
HOURS_IN: {
DAY: number;
WEEK: number;
};
DAYS_IN: {
WEEK: number;
};
};
FIRST_HOUR: number;
today: typeof today;
getStartOfWeek: typeof getStartOfWeek;
getEndOfWeek: typeof getEndOfWeek;
getStartOfMonth: typeof getStartOfMonth;
getEndOfMonth: typeof getEndOfMonth;
parseTime: typeof parseTime;
validateTimestamp: typeof validateTimestamp;
parsed: typeof parsed;
parseTimestamp: typeof parseTimestamp;
parseDate: typeof parseDate;
getDayIdentifier: typeof getDayIdentifier;
getTimeIdentifier: typeof getTimeIdentifier;
getDayTimeIdentifier: typeof getDayTimeIdentifier;
diffTimestamp: typeof diffTimestamp;
updateRelative: typeof updateRelative;
updateMinutes: typeof updateMinutes;
updateWeekday: typeof updateWeekday;
updateDayOfYear: typeof updateDayOfYear;
updateWorkWeek: typeof updateWorkWeek;
updateDisabled: typeof updateDisabled;
updateFormatted: typeof updateFormatted;
getDayOfYear: typeof getDayOfYear;
getWorkWeek: typeof getWorkWeek;
getWeekday: typeof getWeekday;
isLeapYear: typeof isLeapYear;
daysInMonth: typeof daysInMonth;
copyTimestamp: typeof copyTimestamp;
padNumber: typeof padNumber;
getDate: typeof getDate;
getTime: typeof getTime;
getDateTime: typeof getDateTime;
nextDay: typeof nextDay;
prevDay: typeof prevDay;
relativeDays: typeof relativeDays;
findWeekday: typeof findWeekday;
createDayList: typeof createDayList;
createIntervalList: typeof createIntervalList;
createNativeLocaleFormatter: typeof createNativeLocaleFormatter;
makeDate: typeof makeDate;
makeDateTime: typeof makeDateTime;
validateNumber: typeof validateNumber;
isBetweenDates: typeof isBetweenDates;
isOverlappingDates: typeof isOverlappingDates;
daysBetween: typeof daysBetween;
weeksBetween: typeof weeksBetween;
addToDate: typeof addToDate;
compareTimestamps: typeof compareTimestamps;
compareDate: typeof compareDate;
compareTime: typeof compareTime;
compareDateTime: typeof compareDateTime;
getWeekdayFormatter: typeof getWeekdayFormatter;
getWeekdayNames: typeof getWeekdayNames;
getMonthFormatter: typeof getMonthFormatter;
getMonthNames: typeof getMonthNames;
};
export default _default;