/** Why a string was refused as an RFC 3339 instant. */ export type Rfc3339FailureReason = /** Input was not a string (null, undefined, number, object, …). */ 'not_a_string' /** Input did not match the accepted grammar. */ | 'malformed' /** Grammar matched but a field was outside its RFC 3339 range, * including a day that does not exist in its month and hour 24. */ | 'field_out_of_range' /** time-second was 60. See LEAP SECONDS above. */ | 'leap_second' /** The instant is not a safe integer count of milliseconds. */ | 'not_representable'; /** Outcome of {@link parseRfc3339}. `ok: false` carries a reason and never * an instant, so a caller cannot read a time out of a failed parse. */ export type Rfc3339ParseResult = { ok: true; ms: number; } | { ok: false; reason: Rfc3339FailureReason; }; /** * Parse an RFC 3339 instant strictly, for use at a security boundary. * * Returns the instant in milliseconds since the Unix epoch, or a reason. It * never returns NaN and never throws: a caller that ignores `ok` gets a type * error rather than a value that compares false in both directions. * * Invariants: * - Only the grammar documented at the head of this module is accepted; * an absent offset, a date-only value, whitespace, or an empty string is * `malformed`. * - Every field is range-checked, so 2026-02-30 and 24:00:00 are * `field_out_of_range` rather than instants. * - Equal instants written with different offsets return the same `ms`. * - Sub-millisecond digits are validated and then truncated away. */ export declare function parseRfc3339(value: unknown): Rfc3339ParseResult; /** * Render an instant as the RFC 3339 UTC spelling this SDK emits: * YYYY-MM-DDTHH:MM:SS.sssZ, always three fractional digits. * * The counterpart to {@link parseRfc3339}, and byte-identical to * `new Date(ms).toISOString()` for every instant inside the four-digit-year * range — tests/rfc3339.test.ts pins that equality, so switching an emission * site to this function cannot move any artifact's bytes. * * It exists so that a file which verifies timestamps never has to construct * a Date at all. `new Date(x)` accepts a string as readily as a number, and * that ambiguity is the whole of F-04; `formatRfc3339` takes a `number`, so * handing it an artifact's field is a compile error rather than a silent * reparse. That is what lets the boundary guard ban `new Date(` outright * instead of trying to tell emission and interpretation apart by eye. * * A fractional millisecond count is TRUNCATED toward zero rather than * refused, because that is precisely what `new Date(ms)` does (TimeClip, * ECMA-262 21.4.1.15) and this function's whole value is being * indistinguishable from it. Durations arrive from division often enough — * a day divided into sevenths, a sub-millisecond timeout — that refusing them * would turn arithmetic a caller has always been allowed to do into an * exception at an emission site that cannot fail closed usefully. * * @throws RangeError when `ms` is not finite, or falls outside the * representable four-digit-year range. Outside that range `new Date(ms)` * emits an ISO 8601 expanded-year spelling, which is not RFC 3339 and which * {@link parseRfc3339} refuses, so returning one would mint an artifact this * SDK's own verifiers can never read. An emission site holds an instant it * computed itself; a value outside four-digit years is a bug at the caller. */ export declare function formatRfc3339(ms: number): string; //# sourceMappingURL=rfc3339.d.ts.map