@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
18 lines (17 loc) • 801 B
TypeScript
/**
* Check whether an IANA timeZone identifier observes daylight saving time.
*
* - Compares UTC offsets at two dates six months apart (January and July).
* - A zone is considered to have DST if its offset differs between the two dates.
* - Returns false for invalid or unresolvable timeZone identifiers.
*
* @param timeZone timeZone identifier to check
* @returns boolean indicating whether the timeZone observes DST
*
* @example hasDaylightSaving("America/New_York") // true
* @example hasDaylightSaving("Europe/Berlin") // true
* @example hasDaylightSaving("Asia/Tokyo") // false
* @example hasDaylightSaving("UTC") // false
* @example hasDaylightSaving("Invalid/Zone") // false
*/
export declare function hasDaylightSaving(timeZone: string): boolean;