Migrating a Scheduling Feature from Date to Temporal

A migration log for a real scheduling feature moving from JavaScript Date to Temporal: instants, zoned date-times, DST disambiguation, exact vs calendar durations, and month arithmetic. Four decisions account for most of the pain: picking the right Temporal type for each value, handling DST transitions explicitly, separating exact from calendar durations, and turning month math into a visible product decision. The post covers why `Date` parsing differs between date-only and date-time strings, why millisecond math is correct for instants and wrong for calendar intent, why `getTimezoneOffset()` returns inverted minutes, and how `start.add({ days: 1 })` and `start.add({ hours: 24 })` diverge on a spring-forward day. Status note from the post: Temporal is TC39 Stage 3; Firefox ships it by default, Chromium's implementation has been landing behind a flag, and Node does not expose it in a stable release. Check the compatibility table for your own targets, and do not mix native Temporal with a polyfill unless you've run the full test suite against both. The examples ran through `@js-temporal/polyfill`. Full write-up: https://hackyjs.com/posts/migrating-a-scheduling-feature-from-date-to-temporal-dst-durations-and-month-math

javascripttemporal-apidate-timedstmigration

Read the post →