@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
26 lines (25 loc) • 1.46 kB
TypeScript
/**
* Check whether a zoned value's instant falls within daylight saving time.
*
* - The third DST-related function in the roadmap, and distinct from the
* other two — see docs/dst-disambiguation.md for the full four-way split:
* `hasDaylightSaving(timeZone)` asks whether a zone observes DST *at all*
* (zone-level, no instant); `listDstTransitions(timeZone, year)` asks
* *where* a zone's transitions fall (enumerates instants);
* `isInDaylightSaving(value)` asks whether *this particular instant* is
* currently in DST. `disambiguation`/`offset` (Group C) are a fourth,
* orthogonal concern: what to do when construction lands on an ambiguous
* or nonexistent instant.
* - Returns false for invalid input, and false for a zone that doesn't
* observe DST at all.
*
* @param value zoned ISO 8601 datetime string
* @returns true if the instant is in daylight saving time, false otherwise or on invalid input
*
* @example isInDaylightSaving("2024-07-15T12:00:00-04:00[America/New_York]") // true
* @example isInDaylightSaving("2024-01-15T12:00:00-05:00[America/New_York]") // false
* @example isInDaylightSaving("2024-01-15T12:00:00+11:00[Australia/Sydney]") // true (southern-hemisphere summer)
* @example isInDaylightSaving("2024-07-15T12:00:00+09:00[Asia/Tokyo]") // false (Asia/Tokyo has no DST)
* @example isInDaylightSaving("invalid") // false
*/
export declare function isInDaylightSaving(value: string): boolean;