@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.
24 lines • 942 B
TypeScript
/** Date-time fields read from an RFC 9110 HTTP-date, before calendar validation. */
export interface HttpDateFields {
/** ISO day of week 1 (Monday) – 7 (Sunday). */
dayOfWeek: number;
year: number;
month: number;
day: number;
hour: number;
minute: number;
second: number;
}
/**
* Read the fields of an RFC 9110 obsolete HTTP-date: `rfc850-date` or
* `asctime-date`. IMF-fixdate is read with the exported `httpDate` pattern.
*
* - Shape checks only: the calendar date and the day of week are left to the
* caller (`Temporal.PlainDateTime.from` with `overflow: "reject"`).
* - An `rfc850-date` reads the clock (`nowInstant()`) to place its
* two-digit year; that call throws if the clock cannot be read.
*
* @param value candidate obsolete HTTP-date
* @returns the fields, or `null` when `value` is neither obsolete format
*/
export declare function readObsoleteHttpDate(value: string): HttpDateFields | null;