UNPKG

temporal-extra

Version:

Locale-aware date utilities for Temporal: week numbers, date adjusters, polyfill support and more

67 lines (66 loc) 2.61 kB
import "./week-info/polyfill.js"; export type AdjustableDate = Temporal.PlainDate | Temporal.PlainDateTime | Temporal.ZonedDateTime; /** * Returns the previous business day dependent on locale. */ export declare const previousBusinessDay: <T extends AdjustableDate>(date: T, locale: Intl.Locale | string) => T; /** * Returns the next business day dependent on locale. */ export declare const nextBusinessDay: <T extends AdjustableDate>(date: T, locale: Intl.Locale | string) => T; /** * Returns the most recent day matching a given day of week. */ export declare const previousDayOfWeek: <T extends AdjustableDate>(date: T, dayOfWeek: number) => T; /** * Returns the most recent or same day matching a given day of week. */ export declare const previousOrSameDayOfWeek: <T extends AdjustableDate>(date: T, dayOfWeek: number) => T; /** * Returns the closest next day matching a given day of week. */ export declare const nextDayOfWeek: <T extends AdjustableDate>(date: T, dayOfWeek: number) => T; /** * Returns the closest next or same day matching a given day of week. */ export declare const nextOrSameDayOfWeek: <T extends AdjustableDate>(date: T, dayOfWeek: number) => T; /** * Returns the first day of the week dependent on locale. */ export declare const firstDayOfWeek: <T extends AdjustableDate>(date: T, locale: Intl.Locale | string) => T; /** * Returns the last day of the week dependent on locale. */ export declare const lastDayOfWeek: <T extends AdjustableDate>(date: T, locale: Intl.Locale | string) => T; /** * Returns the first day of the month. */ export declare const firstDayOfMonth: <T extends AdjustableDate>(date: T) => T; /** * Returns the last day of the month. */ export declare const lastDayOfMonth: <T extends AdjustableDate>(date: T) => T; /** * Returns the first day of the year. */ export declare const firstDayOfYear: <T extends AdjustableDate>(date: T) => T; /** * Returns the last day of the year. */ export declare const lastDayOfYear: <T extends AdjustableDate>(date: T) => T; /** * Returns the first day of the next month. */ export declare const firstDayOfNextMonth: <T extends AdjustableDate>(date: T) => T; /** * Returns the first day of the next year. */ export declare const firstDayOfNextYear: <T extends AdjustableDate>(date: T) => T; /** * Returns the start of the day. */ export declare const startOfDay: <T extends Temporal.PlainDateTime | Temporal.ZonedDateTime>(dateTime: T) => T; /** * Returns the end of the day. */ export declare const endOfDay: <T extends Temporal.PlainDateTime | Temporal.ZonedDateTime>(dateTime: T) => T;