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, andimport.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
, andprocess on (“rejectionHandled”)
. - The
imports
field indeno.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
anddeno doc
. - Integration has been strengthened with the embedded instance of TypeScript’s Language Service API to achieve significant performance boosts and fix some bugs.