@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.
15 lines • 1.04 kB
TypeScript
/** Forget every verdict (the `Intl.DateTimeFormat` constructor was replaced, a test seam). */
export declare function forgetWeekYearVerdicts(): void;
/**
* The formatter itself when its pattern cannot print the week-of-year year (defects D23, D24),
* else a formatter whose year is the calendar year and whose parts never reach the engine's `Y`
* field.
*
* @param formatter the formatter just built
* @param callerOptions the options it was built with; options with a getter are left unguarded
* @returns the formatter, or its stand-in
*
* @example guardDateTimeFormat(new Intl.DateTimeFormat("en", { year: "numeric" }), { year: "numeric" }) // the same formatter
* @example guardDateTimeFormat(new Intl.DateTimeFormat("gd", { year: "numeric", month: "short", timeZone: "UTC" }), { year: "numeric", month: "short", timeZone: "UTC" }).format(Date.UTC(2024, 11, 30)) // "Dùbh 2024"
*/
export declare function guardDateTimeFormat(formatter: Intl.DateTimeFormat, callerOptions: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;