@northguild/gmt
Version:
Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.
19 lines • 1 kB
TypeScript
/**
* Resolve the minimal-days-in-first-week rule for the locale week-year functions.
*
* - ECMA-402 does not expose a locale's `minimalDays`: `Intl.Locale.prototype.getWeekInfo` returns
* only `firstDay` and `weekend` (Intl Locale Info, WeekInfoOfLocale; the field was dropped in
* tc39/proposal-intl-locale-info#86). So the value comes from the caller, never the runtime.
* - Omitted, it is the ISO 8601 value `4` on every runtime, so one input has one answer.
* - Returns `null` for a value that is not an integer from 1 to 7 — the width of a week.
*
* @param options optional: minimalDays (integer 1–7)
* @returns the minimal days to use, or null when `minimalDays` is out of range
*
* @example resolveMinimalDaysInFirstWeek() // 4
* @example resolveMinimalDaysInFirstWeek({ minimalDays: 1 }) // 1
* @example resolveMinimalDaysInFirstWeek({ minimalDays: 0 }) // null
*/
export declare function resolveMinimalDaysInFirstWeek(options?: {
minimalDays?: number;
}): number | null;