cross-posted from: https://programming.dev/post/31210046

Firefox 139.0 released yesterday, with support for the Temporal JavaScript API.

I explored the API, writing down the most relevant interfaces into a reference or cheat sheet.

It’s certainly and finally a thorough API for handling temporal information. Working with zoned datetime across time offsets and time zones can get very confusing, though.

I love how you can work with them though, especially with durations.

console.log(Temporal.PlainDateTime.from('2025-02-05T08:00:00'))

console.log(Temporal.Now.plainDateTimeISO("Europe/Berlin"))

console.log(Temporal.Now.plainDateTimeISO().add('PT2M0.2S').subtract('PT0.5S').since(Temporal.Now.plainDateTimeISO()))

console.log(Temporal.ZonedDateTime.from('2025-02-05T13:57:35.777888[Europe/Berlin]').withTimeZone('Europe/London'))