# Time zones

> Run the timeline in any IANA time zone, understand how event times are read and displayed, and handle daylight saving transitions correctly.

The scheduler computes everything (ticks, header labels, working-time shading, snapping and the "now" line) in a single time zone. By default that is the browser's time zone. Set `timeZone` to plan in a zone of your choice, for example the time zone of the site where a crew is working.

```ts
import { createScheduler } from '@birchui/scheduler';

createScheduler(container, {
  resources: berlinCrews,
  events: installations,
  start: '2026-12-07',
  end: '2026-12-12',
  viewPreset: 'dayAndWeek',
  timeZone: 'Europe/Berlin',
  locale: 'de-DE',
});
```

A dispatcher in Chicago who opens this board sees 07:00 to 16:00 shifts as 07:00 to 16:00, the way the crews in Berlin experience them, not as 00:00 to 09:00.

## Time zone identifiers

`timeZone` takes an IANA identifier such as `'America/New_York'`, `'Europe/London'`, `'Asia/Kolkata'` or `'UTC'`. The scheduler uses the browser's `Intl` support, so there is no time zone database to download or keep up to date; browsers ship and update it.

List the identifiers the current browser supports, for example to fill a picker:

```ts
const zones = Intl.supportedValuesOf('timeZone');
```

Change the zone at runtime with `update`:

```ts
siteSelect.addEventListener('change', () => {
  scheduler.update({ timeZone: siteSelect.value });
});
```

When the zone changes, every event's original `start` and `end` values are read again in the new zone. Local strings keep their wall-clock time (a 07:00 shift stays at 07:00 on the new clock), while instants keep their absolute moment and move on the axis.

## How times are read

Each `start` and `end` value, in events, in the scheduler's own range and in method arguments, is turned into an instant using these rules:

| Input | Example | Meaning |
| --- | --- | --- |
| ISO string without offset | `'2026-12-07T07:00'` | 07:00 wall-clock time **in the scheduler's `timeZone`**. |
| Date only | `'2026-12-07'` | Midnight at the start of that day in the scheduler's `timeZone`. |
| ISO string with `Z` or an offset | `'2026-12-07T06:00:00Z'` | That exact instant, shown in the scheduler's zone. |
| `Date` or epoch milliseconds | `new Date('2026-12-07T06:00:00Z')` | That exact instant, shown in the scheduler's zone. |

Choose the form that matches what your data means:

- **Local strings** fit times that are defined on a site's clock: a store opening, a room booking, a shift that always starts at 07:00 where the work happens.
- **Instants** (UTC strings, `Date`, numbers) fit times that are absolute: a video call with participants in several zones, or anything your server already stores as UTC.

Mixing both is fine. Each value is converted on its own.

> **Warning**
>
> A string such as `'2026-12-07 07:00'` without a `T` is also read as a local wall-clock time. Other formats, such as `'Dec 7, 2026'`, fall back to `Date.parse`, which uses the browser's time zone rather than the scheduler's. Stick to ISO 8601.

## How times are reported

Event payloads and API return values carry `Date` objects, which are absolute instants. A `Date` has no time zone of its own, so format it with the scheduler's zone when you display it:

```ts
const timeFormat = new Intl.DateTimeFormat('en-GB', {
  timeZone: 'Europe/Berlin',
  weekday: 'short',
  hour: '2-digit',
  minute: '2-digit',
});

scheduler.on('eventDrop', ({ event, start, end }) => {
  statusLine.textContent = `${event.title}: ${timeFormat.format(start)} to ${timeFormat.format(end)}`;
});
```

To send the server a wall-clock string in the scheduler's zone instead of UTC, format the parts yourself:

```ts
function toZonedLocalIso(date: Date, timeZone: string): string {
  const parts = Object.fromEntries(
    new Intl.DateTimeFormat('en-CA', {
      timeZone,
      hourCycle: 'h23',
      year: 'numeric',
      month: '2-digit',
      day: '2-digit',
      hour: '2-digit',
      minute: '2-digit',
    })
      .formatToParts(date)
      .map((part) => [part.type, part.value]),
  );
  return `${parts.year}-${parts.month}-${parts.day}T${parts.hour}:${parts.minute}`;
}

toZonedLocalIso(new Date('2026-12-07T06:00:00Z'), 'Europe/Berlin');
```

The last line returns `'2026-12-07T07:00'`, which the scheduler reads back as the same instant when `timeZone` is `'Europe/Berlin'`.

## Daylight saving time

Because the axis is built from calendar boundaries in the scheduler's zone, clock changes are handled where they happen:

- **Day, week and month ticks** start at local midnight. The day a clock change happens is 23 or 25 hours long, and in `'hourAndDay'` it has 23 or 25 hour columns.
- **Hour ticks** follow the local clock. On the spring-forward night in Berlin (28 March 2027), the hour header goes from 01:00 straight to 03:00.
- **Snapping** works on wall-clock time, so a job dragged across a clock change still lands on 15-minute marks of the local clock.
- **Working-time shading** uses local hours, so 08:00 to 17:00 stays 08:00 to 17:00 on both sides of the change.

Two kinds of local time need a rule, and the scheduler applies these:

| Situation | Example in `Europe/Berlin` | Result |
| --- | --- | --- |
| A time that does not exist (spring forward) | `'2027-03-28T02:30'` | Moves forward by the gap, to 03:30 CEST. |
| A time that happens twice (fall back) | `'2027-10-31T02:30'` | The first occurrence, 02:30 CEST (00:30 UTC). |

If you need the second occurrence of an ambiguous time, pass an instant with an explicit offset, such as `'2027-10-31T02:30+01:00'`.

> **Tip**
>
> Durations measured in milliseconds change across a clock change. A night shift from `'2027-03-27T22:00'` to `'2027-03-28T06:00'` in Berlin lasts seven hours, not eight. If you compute an end from a start, add local hours by building a new local string rather than adding `8 * 3600000`.

## The "now" line

The now line marks the current time, placed in the scheduler's zone like everything else. It is shown by default; `showNowLine: false` hides it. For screenshots, demos and tests, pin the clock with `now`:

```ts
createScheduler(container, {
  resources,
  events,
  start: '2026-12-07T06:00',
  end: '2026-12-07T20:00',
  viewPreset: 'hourAndDay',
  timeZone: 'America/Chicago',
  now: '2026-12-07T10:15',
});
```

## Next steps

- [Working time](https://docs.birchui.com/scheduler/working-time.md) for business hours and weekends.
- [View presets and zoom](https://docs.birchui.com/scheduler/view-presets.md#header-formats) for header labels in any locale.
