@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
24 lines (23 loc) • 1.1 kB
TypeScript
/**
* Return true when the Unix timestamp 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 Unix timestamp to check
* @param start Unix timestamp for range start
* @param end Unix timestamp for range end
* @param options optional: epochUnit ("seconds" | "milliseconds"), timeZone (IANA), inclusiveStart (boolean), inclusiveEnd (boolean)
* @returns boolean indicating whether value is between start and end
*
* @example isBetweenUnix(1705000000000, 1704000000000, 1706000000000) // true
* @example isBetweenUnix(1705000000, 1704000000, 1706000000, { epochUnit: "seconds" }) // true
* @example isBetweenUnix(1703000000000, 1704000000000, 1706000000000) // false
*/
export declare function isBetweenUnix(value: number, start: number, end: number, options?: {
epochUnit?: "seconds" | "milliseconds";
timeZone?: string;
inclusiveStart?: boolean;
inclusiveEnd?: boolean;
}): boolean;