Temporal: The Curious Incident of the Wrong Nighttime

Bookmark
Rate this content

This is the story of how I almost spent a night on the street — because of JavaScript's Date object! We'll dive in and try to understand why that happened, and how to prevent it. Luckily coming soon to a browser near you is Temporal, the JavaScript built-in API that makes this kind of mess-up a thing of the past.

This talk has been presented at JSNation 2025, check out the latest edition of this JavaScript Conference.

FAQ

Temporal is a proposal to add modern date and time handling capabilities directly into JavaScript, rather than relying on external libraries or packages. It aims to improve the standardization and functionality of date and time operations in the language.

Temporal was created to address the pitfalls and limitations of the old JavaScript date object, such as issues with time zones and zero-based months, and to provide a more reliable and intuitive way to handle date and time in JavaScript.

Temporal provides a more robust handling of time zones by allowing developers to work with exact moments in time and wall time independently of time zones. This prevents common errors associated with time zone conversions in the old Date object.

Temporal includes types such as Instant, PlainDate, PlainTime, PlainYearMonth, PlainMonthDay, ZonedDateTime, and Duration, each designed to handle different aspects of date and time with specific purposes and limitations.

As of now, Temporal is available in Firefox. Safari has partial support behind a flag in tech preview, and there are ongoing efforts to implement it in Chrome and Node.js.

Yes, while Temporal aims to replace the old Date object and reduce the need for external libraries, existing libraries like Moment.js and Date.fns can still coexist and may offer additional functionalities over Temporal.

The immutability of Temporal objects ensures that they cannot be accidentally modified by functions or libraries, providing more certainty and preventing unintended side effects in date and time manipulations.

Igalia is involved in the standardization process of Temporal as part of its collaboration with other companies, helping to improve the state of the web platform through open standards.

Yes, there are polyfills available for Temporal, such as those from Full Calendar and js-Temporal, which allow developers to use Temporal features in environments where it is not natively supported yet.

Temporal has strong support for internationalization, allowing developers to handle date and time operations in a way that respects different locales and time zone requirements, reducing errors and improving user experience globally.

 Philip Chimento
Philip Chimento
25 min
12 Jun, 2025

Comments

Sign in or register to post your comment.
Video Summary and Transcription
Speaker's involvement in Temporal proposal and TC39 meetings for JavaScript standardization. Date conversion challenges faced in development. Addressing time zone discrepancies with Temporal to prevent bugs. Exploration of Temporal types and design philosophy. Usage of Java's time zone serialization in JavaScript Temporal. Challenges in implementing Temporal proposal and its transformative potential in ECMAScript.
Video transcription and chapters available for users with access.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Install Nothing: App UIs With Native Browser APIs
JSNation 2024JSNation 2024
31 min
Install Nothing: App UIs With Native Browser APIs
Top Content
This Talk introduces real demos using HTML, CSS, and JavaScript to showcase new or underutilized browser APIs, with ship scores provided for each API. The dialogue element allows for the creation of modals with minimal JavaScript and is supported by 96% of browsers. The web animations API is a simple and well-supported solution for creating animations, while the view transitions API offers easy animation workarounds without CSS. The scroll snap API allows for swipers without JavaScript, providing a smooth scrolling experience.
Standardizing Signals in TC39
JSNation US 2024JSNation US 2024
29 min
Standardizing Signals in TC39
I'll be talking about standardizing signals in TC39. Immediate mode wipes out the whole screen and writes a new one, while retained mode changes only what is necessary. Signals represent a cell of data that can change over time. The correct solution is to topologically sort dependencies and evaluate them in a coherent order. Standard signals allow for code sharing across frameworks and the creation of reusable infrastructure. The signal API is designed to be wrapped by different frameworks. Standards can achieve more portability and reduce the need to lock into specific ecosystems. The API includes a watcher, a set of signals being observed, with a synchronous callback made when the first member becomes potentially dirty. The speaker discusses how signals relate to state management libraries in React and mentions the potential for signals to become a web standard in the future.
Future Features of JS?!
JSNation 2022JSNation 2022
28 min
Future Features of JS?!
Top Content
Welcome to the future features of JavaScript, including proposals for array operations, throw expressions, records and TPUs, pipeline operators, and more. The talk covers the introduction of type assertions for imported files, non-mutating array operations, and the simplification of error handling. It also explores the concept of immutability with records and TPUs, and the use of the pipeline operator to simplify code. Other proposals include Map.implace, IteratorHelper, slice notation, type annotations, Array UNIQBY, number ranges, and the Function 1 proposal.
Pushing the Limits of Video Encoding in Browsers With WebCodecs
JSNation 2023JSNation 2023
25 min
Pushing the Limits of Video Encoding in Browsers With WebCodecs
Top Content
Watch video: Pushing the Limits of Video Encoding in Browsers With WebCodecs
This Talk explores the challenges and solutions in video encoding with web codecs. It discusses drawing and recording video on the web, capturing and encoding video frames, and introduces the WebCodecs API. The Talk also covers configuring the video encoder, understanding codecs and containers, and the video encoding process with muxing using ffmpeg. The speaker shares their experience in building a video editing tool on the browser and showcases Slantit, a tool for making product videos.
WebHID API: Control Everything via USB
JSNation 2022JSNation 2022
23 min
WebHID API: Control Everything via USB
Today's Talk introduces the webHID API, which allows developers to control real devices from the browser via USB. The HID interface, including keyboards, mice, and gamepads, is explored. The Talk covers device enumeration, input reports, feature reports, and output reports. The use of HID in the browser, especially in Chrome, is highlighted. Various demos showcase working with different devices, including a DualShock controller, microphone, gamepad, and Stream Deck drum pad. The Talk concludes with recommendations and resources for further exploration.
Automate the Browser With Workers Browser Rendering API
JSNation 2024JSNation 2024
20 min
Automate the Browser With Workers Browser Rendering API
The Talk discusses browser automation using the Worker's Browser Rendering API, which allows tasks like navigating websites, taking screenshots, and creating PDFs. Cloudflare integrated Puppeteer with their workers to automate browser tasks, and their browser rendering API combines remote browser isolation with Puppeteer. Use cases for the API include taking screenshots, generating PDFs, automating web applications, and gathering performance metrics. The Talk also covers extending sessions and performance metrics using Durable Objects. Thank you for attending!

Workshops on related topic

Writing Universal Modules for Deno, Node and the Browser
Node Congress 2022Node Congress 2022
57 min
Writing Universal Modules for Deno, Node and the Browser
Workshop
Luca Casonato
Luca Casonato
This workshop will walk you through writing a module in TypeScript that can be consumed users of Deno, Node and the browsers. I will explain how to set up formatting, linting and testing in Deno, and then how to publish your module to deno.land/x and npm. We’ll start out with a quick introduction to what Deno is.