@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
20 lines (19 loc) • 972 B
TypeScript
/**
* 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: inclusiveStart (boolean), inclusiveEnd (boolean)
* @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?: {
inclusiveStart?: boolean;
inclusiveEnd?: boolean;
}): boolean;