Paul Krill
Editor at Large

Deno adds API for date and time operations

news
Jan 25, 20242 mins

The Temporal API eases advanced data and time computations including daylight savings time arithmetic, addressing shortcomings in JavaScript’s Date object.

interational time zones clocks global business thinkstock
Credit: Thinkstock

Deno 1.40, the latest version of the JavaScript runtime positioned as a rival to Node.js, has been launched with a Temporal API for advanced date and time operations.

The update was announced January 25. Deno can be accessed from deno.com.

The Temporal API is intended to address shortcomings of the existing Date object in JavaScript. It’s available with the –-unstable-temporal flag. Temporal acts as a top-level namespace that brings a modern date/time API to JavaScript. Temporal provides separate classes for date-only, time-only, and other scoped use cases, making code more readable and preventing bugs caused by incorrectly assuming 0, UTC, or the local time zone for values that are actually unknown.

Deno 1.40 also embraces the latest ECMAScript decorator syntax for more expressive code. With the decorator syntax, Deno now supports the ECMA Stage 3 decorators proposal for browsers. Decorators are a proposal for extending JavaScript classes and are widely adopted among developers in transpiler environments.

Other features in Deno 1.40 include the following:

  • Deno now supports the properties import.meta.filename, which provides a path for the current module file, and import.meta.dirname, which provides a path to the directory containing the current module file.
  • Built-in Node.js APIs are now available such as fs.constants, os.machine, and process on (“rejectionHandled”).
  • The imports field in deno.json now supports a simpler syntax for specifying dependencies that have subpath exports.
  • Diagnostics have been improved with a new diagnostic printer in deno lint and deno doc.
  • Integration has been strengthened with the embedded instance of TypeScript’s Language Service API to achieve significant performance boosts and fix some bugs.
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