UNPKG

@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.

31 lines • 1.31 kB
/** * Return true when `zoned` is between `start` and `end` (inclusive by default). * * - Validates inputs and then compares using Temporal.Instant (same instant semantics). * - Returns false for invalid inputs. * * @param zoned ISO ZonedDateTime string to check * @param start ISO ZonedDateTime string for the start of the range * @param end ISO ZonedDateTime string for the end of the range * @param options optional settings for whether each end of the range is included * @returns boolean indicating whether zoned is between start and end * * @example isBetweenZoned("2024-02-29T12:00:00+00:00[UTC]", "2024-02-29T11:00:00+00:00[UTC]", "2024-02-29T13:00:00+00:00[UTC]") // true * @example isBetweenZoned("invalid", "2024-02-29T11:00:00+00:00[UTC]", "2024-02-29T13:00:00+00:00[UTC]") // false */ export declare function isBetweenZoned(zoned: string, start: string, end: string, options?: { /** * Whether `zoned` at the same instant as `start` counts as inside the range. `false` requires * it to be after `start`. * * @defaultValue `true` */ inclusiveStart?: boolean; /** * Whether `zoned` at the same instant as `end` counts as inside the range. `false` requires it * to be before `end`. * * @defaultValue `true` */ inclusiveEnd?: boolean; }): boolean;