Skip to content

This notebook belongs to

Sadat Jubayer

Senior Software Engineer at Premio

If found, please return to hello@jubayer.dev

Vol. 7Seven years of building

Started
January 2020
Everyday tools
TypeScript, Vue, React, Next.js, NestJS, React Native
Education
B.Sc. CSSE, AIUB, 2020
2 min readJavaScript

Keep meeting times across DST with Temporal

Use Temporal.ZonedDateTime to move a meeting by one calendar day across daylight saving time, then convert it for an attendee.

You move a 9 a.m. New York meeting to the next day, and the invite lands at 10 a.m. Your code added 24 hours across the spring clock change. The calendar rule was to keep 9 a.m. in New York.

Add a day in the meeting's time zone

Temporal.ZonedDateTime keeps the instant and a named time zone such as America/New_York. The zone supplies the offset for the date you are calculating. An offset such as -05:00 describes one point on the calendar and cannot tell you when that area's clocks change.

Run this in a runtime with Temporal, such as Node 26.

const meeting = Temporal.ZonedDateTime.from(
  '2026-03-07T09:00-05:00[America/New_York]',
)

const tomorrow = meeting.add({ days: 1 })
const after24Hours = meeting.add({ hours: 24 })

console.log(tomorrow.toString())
console.log(after24Hours.toString())
console.log(tomorrow.withTimeZone('Europe/London').toString())

You get 9 a.m. and 10 a.m. in New York, then 1 p.m. in London for the 9 a.m. meeting.

Both New York results have offset -04:00. The meeting started on March 7 with offset -05:00. New York moves the clocks forward overnight, so reaching the same wall-clock hour on March 8 takes 23 elapsed hours.

diagram

One day across the New York clock change

Adding one calendar day lands at 9 a.m. in New York after 23 elapsed hours.

Use add({ days: 1 }) to move a calendar appointment forward a day. Use add({ hours: 24 }) for a duration measured by a clock. The Temporal documentation makes that distinction for date and time units.

A Date can represent either resulting instant. Adding milliseconds to its timestamp counts elapsed time. For a rule tied to New York's calendar, carry the zone into the calculation so you can ask for the next date there.

Convert the result for the attendee

tomorrow.withTimeZone('Europe/London') keeps the instant and gives you the local date, time and offset for London. Run this conversion after you choose the meeting instant in the organizer's zone. Formatting the original meeting for London first and then adding a London calendar day would apply London's clock rules to the reschedule.

For a calendar UI that accepts any local time, check how it handles hours that disappear or repeat. Temporal exposes a disambiguation option when you construct a zoned date-time from a local time and zone. Choose 'reject' if you want the UI to ask the organizer to pick a valid time or resolve an ambiguous one.