/** * utilities around unicode technical standard 35 * * @see {@link https://unicode.org/reports/tr35/tr35-dates.html#table-date-field-symbol-table} * @module */ import { type Codec } from "./Codec.js"; /** * date formats keyed by regex. * * Explicitly sorted by resolution low -> high and within a resolution from most specific to most generic */ export declare const dateFormatEntries: (readonly [RegExp, { type: "era"; }] | readonly [RegExp, { type: "year"; }] | readonly [RegExp, { type: "month"; }] | readonly [RegExp, { type: "weekday"; }] | readonly [RegExp, { type: "day"; }] | readonly [RegExp, { type: "period"; }] | readonly [RegExp, { type: "hour"; }] | readonly [RegExp, { type: "minute"; }] | readonly [RegExp, { type: "second"; }] | readonly [RegExp, { type: "fractionalSecond"; }] | readonly [RegExp, { type: "timeZoneName"; }])[]; export type PartDefinition = (typeof dateFormatEntries)[number][1] | { type: "literal"; } | { type: "unknown"; }; export type FormatPart = PartDefinition & { value: string; }; export type PatternPart = { pattern: string; } & PartDefinition; export type ValuePart = PatternPart & { value: string; }; export declare const lowToHighResolution: (a: PartDefinition, b: PartDefinition) => number; export declare const patternToParts: (pattern: string) => PatternPart[]; export declare const valueToParts: (string: string, pattern: string) => ValuePart[]; export declare const splitBySeperators: (string: string, pattern: string) => FormatPart[]; export declare const parse: (value: string, pattern: string) => Date; export declare const format: (value: Date, pattern: string) => string; export declare const formatToParts: (value: Date, pattern: string) => FormatPart[]; /** * assign a stringified value to a date according to a pattern */ export declare const assign: (date: Date, pattern: string, value: string) => Date; /** * creates a new codec with the given UTS35 pattern */ export declare const uts35__Date: (pattern: string) => Codec;