UNPKG

@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.

14 lines • 762 B
/** * Normalize a date-time unit string to its singular form. * * - Accepts singular ("day"), plural ("days"), and already-singular forms. * - Returns the original string if it is not a recognized DateTimeUnit. * - Returns a non-string input unchanged, so callers can pass raw option values and let their own * validator reject them (Temporal §13.17 GetTemporalUnitValuedOption accepts both spellings). * - Singular counterpart of `resolveDurationUnit`, which normalizes to plurals. * * @param unit raw unit value from caller input * @returns normalized singular unit string, or the original if not recognized */ export declare function resolveDateTimeUnit(unit: string): string; export declare function resolveDateTimeUnit(unit: unknown): unknown;