@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.
49 lines • 2.3 kB
TypeScript
import { Temporal } from "../temporal.js";
/** Defect ids from the temporalCompat README's workaround table. */
export type DefectId = "D1" | "D2" | "D3" | "D4" | "D5" | "D6" | "D7" | "D8" | "D10" | "D11" | "D12" | "D13" | "D14" | "D15" | "D16" | "D17" | "D18" | "D19" | "D22";
export interface ProbeRepro {
defect: DefectId;
/** Temporal calendar id the repro exercises. */
calendar: string;
/** Short name, unique per defect and calendar. */
name: string;
/** The spec-correct output of `run()`. */
expected: string;
run: () => string;
}
/**
* What `read` returns for a length from `origin`, or `"none"` when it throws. A thrown message and
* type vary by engine and build: Chromium throws a `RangeError`, a debug polyfill's assert an `Error`.
* Only the read can report no value, so `origin` and `duration` are parsed outside the `try`. A zone
* this engine lacks, or an offset its data disagrees with, fails the repro rather than passing it, and
* so does a `TypeError`, which is a broken read.
*/
export declare function readOrNone(origin: string, duration: string, read: (length: Temporal.Duration, zoned: Temporal.ZonedDateTime) => number | string): string;
/** The shipped-probe groups, each in the order the full table places it. */
export declare const probeReproGroups: {
readonly d1: ProbeRepro[];
readonly d1Arithmetic: ProbeRepro[];
readonly d1RelativeTo: readonly [ProbeRepro];
readonly d10: ProbeRepro[];
readonly d12: ProbeRepro[];
readonly d13: readonly ProbeRepro[];
readonly d14: readonly ProbeRepro[];
readonly d15: readonly ProbeRepro[];
readonly d16: readonly ProbeRepro[];
readonly d17: readonly ProbeRepro[];
readonly d18: readonly ProbeRepro[];
readonly d19: readonly ProbeRepro[];
readonly d22: readonly ProbeRepro[];
readonly d6: ProbeRepro[];
readonly d7: readonly [ProbeRepro, ProbeRepro];
/** D2-D5 and D8: single-read repros. */
readonly reads: readonly [ProbeRepro, ProbeRepro, {
readonly defect: "D3";
readonly calendar: "hebrew";
readonly name: "-100000-01-01";
readonly expected: "12";
readonly run: () => string;
}, ProbeRepro, ProbeRepro, ProbeRepro, ...ProbeRepro[]];
};
/** Every repro a shipped capability probe reads. */
export declare const probeRepros: readonly ProbeRepro[];