@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.
26 lines • 1.05 kB
TypeScript
/** Date-time fields read from an RFC 5322 `date-time`, before calendar validation. */
export interface Rfc5322DateTimeFields {
/** ISO day of week 1 (Monday) – 7 (Sunday), when the input names one. */
dayOfWeek: number | undefined;
year: number;
month: number;
day: number;
hour: number;
minute: number;
second: number;
/** `±HH:MM`; `-0000` and every zone RFC 5322 maps to it are `+00:00`. */
offset: string;
}
/**
* Read the fields of an RFC 5322 `date-time` as a conformant receiver must:
* the §3.3 syntax plus the §4 obsolete syntax (CFWS between tokens, 2- and
* 3-digit years, alphabetic zones), with case-insensitive names.
*
* - Shape and name checks only: the calendar date, the time of day and the
* day of week are left to the caller (`Temporal.PlainDateTime.from` with
* `overflow: "reject"`).
*
* @param value candidate RFC 5322 date-time
* @returns the fields, or `null` when `value` is not a `date-time`
*/
export declare function readRfc5322DateTime(value: string): Rfc5322DateTimeFields | null;