hasDaylightSaving
Signature
Section titled “Signature”hasDaylightSaving(timeZone: string): booleanimport { hasDaylightSaving } from "@northguild/gmt/zoned/validate";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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
timeZone |
string |
timeZone identifier to check |
Returns
Section titled “Returns”boolean indicating whether the timeZone observes DST
Examples
Section titled “Examples”hasDaylightSaving("America/New_York") // truehasDaylightSaving("Europe/Berlin") // truehasDaylightSaving("Asia/Tokyo") // falsehasDaylightSaving("UTC") // falsehasDaylightSaving("Invalid/Zone") // false