# hasDaylightSaving

Industry: Core

## Signature

```ts
hasDaylightSaving(timeZone: string, options?: { at?: string; }): boolean
```

Check whether a timeZone observes daylight saving time at a reference instant.

- True when the zone is in daylight time at the reference instant, or a daylight period begins less than 365 days after it. So a zone in its winter is true, and a zone that has stopped changing its clocks is false.
- With `options.at` the answer does not depend on the day the code runs.
- The rule is GMT's own definition, not the tz database's daylight flag, which no JavaScript API exposes: daylight time runs from a forward change of the zone's clocks to the backward change of the same size that undoes it, less than 365 days later.
- Read as standard time, because the offsets do not show otherwise: the last summer before a zone kept its daylight offset for good; a daylight period held 365 days or longer; one that began, ended or was interrupted by a move of standard time, so the offset changes part-way through and the rest, or all, of it is not paired (`Asia/Tomsk` 2002); and one whose end is past the last instant Temporal can represent.
- A forward change never undone is a change of standard time: `Europe/Istanbul` is false from 2016 on, although its clocks went forward in March 2016.
- Read from the runtime's time zone data, so the answer can change when that data does.
- Returns false for an invalid timeZone, an invalid `at`, an options argument that is not an object, and a fixed UTC offset, with or without seconds (`"+05:30"`, `"-00:44:30"`).

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `timeZone` | `string` | IANA name or UTC offset: a time zone identifier (`+05:30`, `+0530`, `-08`) or a stored offset (`±HH:MM[:SS]`, what `getTimeZoneOffset` returns) |

## Options

**options**

optional setting for the reference instant

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `at?` | `string` | The current instant. | The reference instant the zone is judged at, as an ISO 8601 instant string ending in `Z` or an offset, as `isValidInstant` reads it. A bracketed zone or any other annotation makes it invalid. An invalid value returns false. |

## Returns

boolean indicating whether the timeZone observes DST, or false on invalid input

## Examples

```ts
import { hasDaylightSaving } from "@northguild/gmt/zoned/validate";

hasDaylightSaving("Europe/London", { at: "2024-01-15T12:00:00Z" }) // true
```

## Source

[zoned/validate/hasDaylightSaving.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/zoned/validate/hasDaylightSaving.ts)
