Paul Krill
Editor at Large

JavaScript Temporal to ease dates and times

news
Jan 31, 20252 mins

Support for JavaScript’s new Temporal object is finally arriving in web browsers, giving developers a simpler alternative to the problematic Date.

shutterstock 435558448 old clocks on brick wall time, time change, timeless
Credit: ezpick / Shutterstock

Web developers will soon find it easier to work with dates and times in JavaScript, thanks to emerging browser support for JavaScript’s Temporal object, according to Mozilla.

Implementations of the new Temporal object have begun shipping in experimental releases of browsers, said Brian Smith, staff technical writer on the MDN Web Docs team at Mozilla, in a blog post on January 23. Applications relying on scheduling, time-sensitive data, or internationalization can use Temporal for precise, consistent dates, times, calendars, and durations.

However, stable, cross-browser support for Temporal has not been reached yet, and changes may be made as implementations develop, Smith said. Mozilla’s Firefox browser appears to have the most-mature implementation at this juncture, with support being built into the Nightly version behind the behind the javascript.options.experimental.temporal preference, he said. The main browser bugs that track Temporal implementations include Firefox, Safari and Chrome.

JavaScript Temporal was designed as a full replacement for the JavaScript Date object, to make date and time management reliable and predictable, Smith said. The date object has supported a user’s local time and UTC, with no time zone support. It also has had unreliable parsing and Date is mutable, a situation that can produce hard-to-trace bugs, according to Smith. Also, there are problems with Date across daylight savings time and historical calendar changes.

By contrast, Temporal offers support for time zone and calendar representations and many built-in methods for conversions, comparisons, computations, formatting, and other capabilities. Key concepts in Temporal include unique points in history, wall clock times, and durations. With experimental implementations landing, it is a good time to try out Temporal and become familiar with it, said Smith. MDN has online documentation on Temporal.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author