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.

19 lines • 875 B
/** * Return the month-day (`--MM-DD`) of an ISO 8601 date-time string. * * - The year and the time are dropped, so the time never moves the day. * - A `Z`, an offset or any annotation gives `""`, as `isValidDateTime` reads a plain * date-time. * - Only the ISO calendar is read. * - Returns "" for invalid input. * * @param value ISO date-time string * @returns The canonical `--MM-DD` string, or "" on invalid input * * @example parseMonthDayFromDateTime("2024-12-25T10:00:00") // "--12-25" * @example parseMonthDayFromDateTime("2024-02-29T23:59:59.999999999") // "--02-29" * @example parseMonthDayFromDateTime("2024-12-25") // "" * @example parseMonthDayFromDateTime("2024-12-25T10:00:00Z") // "" * @example parseMonthDayFromDateTime("2024-12-25T10:00:00[Europe/Paris]") // "" */ export declare function parseMonthDayFromDateTime(value: string): string;