@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 • 1.07 kB
TypeScript
import { Temporal } from "./temporal.js";
import { Disambiguation } from "../types/disambiguation.js";
import { Offset } from "../types/offset.js";
import { Overflow } from "../types/overflow.js";
import "../types/index.js";
/**
* The `setZoned` core: a `ZonedDateTime` with the checked `fields` set, correct at the range
* limits on both paths.
*
* An empty set changes nothing, where Temporal's `with()` would throw. May throw where Temporal
* does; each caller maps that to its sentinel.
*
* @param zoned the value to change
* @param fields the caller's `fields` argument
* @param options the resolved `overflow`, `disambiguation` and `offset`
* @returns the changed value, or `null` when `fields` is invalid
*
* @example setZonedFields(zoned, { hour: 9 }, { overflow: "constrain", disambiguation: "compatible", offset: "prefer" })?.toString()
*/
export declare function setZonedFields(zoned: Temporal.ZonedDateTime, fields: unknown, options: {
overflow: Overflow;
disambiguation: Disambiguation;
offset: Offset;
}): Temporal.ZonedDateTime | null;