@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.
25 lines • 1.45 kB
TypeScript
import { TwoDigitYearOptions } from "../types/two-digit-year.js";
/** The SSIM month letters, January first: the first three letters of each English month name, upper case. */
export declare const SSIM_MONTH_LETTERS: readonly ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"];
/** The fields of a `DDMMMYY` value, as numbers: day 0–99, month 1–12, two-digit year 0–99. */
export interface SsimDateFields {
day: number;
month: number;
yy: number;
}
/** Read the fields of a `DDMMMYY` value, or null when the shape does not match. */
export declare function readSsimDateFields(value: string): SsimDateFields | null;
/** Write `DDMMMYY` from a day 1–31, a month 1–12 and a year 0–99. The caller passes valid values. */
export declare function writeSsimDate(day: number, month: number, yy: number): string;
/**
* The core of `parseSsimDate` and `isValidSsimDate`: the ISO date an SSIM `DDMMMYY` names, with
* its two-digit year placed by the caller's `yearWindow` option. Never throws.
*
* @param value an SSIM date such as `15MAR24`
* @param options how the two-digit year is placed
* @returns the ISO 8601 date, or `""` when `value` or `options` is invalid
*
* @example readSsimDate("15MAR24", { yearWindow: 2000 }) // "2024-03-15"
* @example readSsimDate("32MAR24", { yearWindow: 2000 }) // ""
*/
export declare function readSsimDate(value: string, options: TwoDigitYearOptions): string;