RVA JS Logo

Just in Time: The JavaScript Temporal API

Gareth Bromser-Kloeden

Software Engineer at Vareto

Gareth Bromser-Kloeden

Date and time handling has been a thorn in the side of JavaScript developers since the language’s introduction in 1995. Difficulties with timezones, confusing month indexing, date mutability, and non-standard browser parsing are just a few of the problems we face when trying to work with the Date object. Developers commonly turn to libraries like Luxon and date-fns to bridge these gaps, at the cost of external dependencies and opinionated APIs. Enter Temporal: first introduced in 2018, this new API is designed to standardize handling of dates and times in JavaScript as a first-class feature of the language. Temporal builds upon decades of learning from native Date and third party libraries to solidify a modern, comprehensive approach to working with dates, times, time zones, and durations. We’ll learn about common pain points with Date, why relying on third parties libraries is not an ideal solution, and how Temporal promises to address these problems by offering developers a standard, intuitive, and sane API that’ll make your code more maintainable and accessible. Attendees will also come away with an understanding of the history of Temporal from its conception to its present status as a Stage 3, recommended-for-implementation TC39 proposal. Presentation content will include an overview of the Temporal proposal, comparisons with existing solutions like Date and different libraries, and in-depth examples with code of how Temporal solves common problems involving dates, times, and durations. As Temporal is intended to be added to the ECMAScript specification, it is applicable to all JavaScript developers no matter their area of expertise - frontend, backend, React, Svelte, Node, Deno, Bun - anyone who writes JavaScript can benefit from the power and standardization Temporal offers, from novices to seasoned experts.