Migrate to Temporal with GMT
GMT follows the Temporal specification. Moving to it from a date library changes the same few things whichever library you leave, so they are listed once here. Each library page then maps its calls one by one.
What changes
Section titled “What changes”- Strings in, strings out. A GMT value is a string in ISO 8601 form, with the RFC 9557
[zone]suffix for a zoned value. There is no object to construct, and a string cannot change after you make it. Check one with a validator such asisValidDateorisValidZonedDateTime. - Bad input gives a typed fallback. A function that cannot read its input returns
"",null,falseor[]for its return type, and does not throw. A correct empty result, such as two intervals that do not overlap, is[]too, so read the function’s page for what its fallback means. - Months run from 1 to 12. This matches Temporal. A library that counts from 0 needs each month number moved by one.
- No token formatter. GMT formats through
Intlwith a locale and a style, as informatDate(value, "de-DE", { dateStyle: "long" }). It does not read tokens such asdd/MM/yyyywhen it writes.parseDateWithPatternreads them. - A day in a zone is a calendar day. Adding one day to a zoned value gives the same wall-clock time on the next date when that time exists, as Temporal does. When it falls in a gap, the result moves forward by the length of the gap (Temporal 6.5.5 AddZonedDateTime, with the default
compatibledisambiguation):addZoned("2024-03-30T02:30:00+01:00[Europe/Berlin]", { days: 1 })gives2024-03-31T03:30:00+02:00[Europe/Berlin]. Adding hours adds exact time.
| Page | What it covers |
|---|---|
| date-fns | Every date-fns call with its GMT function, and the cases where date-fns differs from Temporal |
| Luxon | The same for Luxon |
| Day.js | The same for Day.js |
| Moment.js | The same for Moment.js |
| @internationalized/date | The same for @internationalized/date |
| Native Temporal and GMT | Which runtimes ship Temporal, and the GMT function for each Temporal call |
The results behind the differences are in Behaviour of date libraries against Temporal.
For a comparison of how each library handles time zones and DST, see Time zones and DST in JavaScript: which date library handles them.
Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else:© 2026 NorthGuild, all rights reserved.