@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.25 kB
TypeScript
import { Temporal } from "./temporal.js";
import { DateTimeUnit } from "../types/date-time-unit.js";
import { FractionalDigit } from "../types/fractional-digit.js";
import "../types/index.js";
/**
* Internal shared implementation for `startOfZoned` / `endOfZoned`.
*
* - Snaps to the real local bucket from `internal/zonedBucket.ts` in `value`'s own zone: a
* start is never after `value`, an end never before it.
* - `weekStartsOn` picks the week's first day. An end is written at nanosecond precision by
* default (next start − 1 ns); a start's `fractionalSecondDigits` defaults to the unit's own
* precision (see `defaultFractionalDigits`).
* - `unit` may be singular or plural; an invalid `weekStartsOn` returns "".
*
* @param value zoned ISO 8601 datetime string
* @param unit DateTimeUnit to snap to, singular or plural
* @param options optional: weekStartsOn, fractionalSecondDigits
* @param isEnd false for start-of-unit, true for end-of-unit
* @returns zoned ISO 8601 string, or "" on invalid input
*/
export declare function startOrEndOfZoned(value: string, unit: Temporal.SmallestUnit<DateTimeUnit>, options: {
weekStartsOn?: "monday" | "sunday";
fractionalSecondDigits?: FractionalDigit;
}, isEnd: boolean): string;