@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
22 lines (21 loc) • 1.04 kB
TypeScript
/**
* Return true when `value` is between `start` and `end` (inclusive by default).
*
* - Uses Temporal.Instant.compare for comparison.
* - Returns false if start > end or inputs are invalid.
* - Use options.inclusiveStart/inclusiveEnd to control boundaries.
*
* @param value ISO UTC datetime string to check
* @param start ISO UTC datetime string for range start
* @param end ISO UTC datetime string for range end
* @param options optional: inclusiveStart (boolean), inclusiveEnd (boolean)
* @returns boolean indicating whether value is between start and end
*
* @example isBetweenUtc("2024-03-15T12:00:00Z", "2024-03-10T12:00:00Z", "2024-03-20T12:00:00Z") // true
* @example isBetweenUtc("2024-03-25T12:00:00Z", "2024-03-10T12:00:00Z", "2024-03-20T12:00:00Z") // false
* @example isBetweenUtc("invalid", "2024-03-10T12:00:00Z", "2024-03-20T12:00:00Z") // false
*/
export declare function isBetweenUtc(value: string, start: string, end: string, options?: {
inclusiveStart?: boolean;
inclusiveEnd?: boolean;
}): boolean;