Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ export const sidebar = [
"https://www.youtube.com/watch?v=oxVwTT-rZRo&list=PLvvLnBDNuTEov9EBIp3MMfHlBxaKGRWTe&index=6",
type: "video",
},
{
title: "Temporal API",
href: "/examples/temporal/",
type: "example",
},
{
title: "Better debugging with the console API",
href: "/examples/debugging_with_console_tutorial/",
Expand Down Expand Up @@ -1077,11 +1082,6 @@ export const sidebar = [
href: "/examples/udp_connector/",
type: "example",
},
{
title: "Temporal API",
href: "/examples/temporal/",
type: "example",
},
{
title: "Importing text",
href: "/examples/importing_text/",
Expand Down
4 changes: 2 additions & 2 deletions examples/scripts/temporal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
* @title Temporal API
* @difficulty beginner
* @tags cli
* @run --unstable-temporal <url>
* @run <url>
* @resource {https://docs.deno.com/api/web/~/Temporal} Temporal API reference documentation
* @resource {https://tc39.es/proposal-temporal/docs} Temporal API proposal documentation
* @group Unstable APIs
* @group Web APIs
*/

// Get the current date
Expand Down
30 changes: 9 additions & 21 deletions runtime/reference/cli/unstable_flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,28 +236,20 @@ Please use these feature flags instead moving forward.

## `--unstable-temporal`

Enable the experimental [Temporal API](https://tc39.es/proposal-temporal/docs/)
in the global scope. The Temporal API is a modern date and time API that is
being developed as a replacement for the legacy `Date` object in JavaScript. It
provides better support for time zones, calendars, and more precise date/time
calculations.
:::note

To use the Temporal API in your Deno program, run it with the flag:
As of Deno 2.7, the Temporal API is **stable** and available by default. The
`--unstable-temporal` flag is no longer required.

```sh
deno run --unstable-temporal your_script.ts
```
:::

Or configure it in your `deno.json`:

```json title="deno.json"
{
"unstable": ["temporal"]
}
```
The [Temporal API](https://tc39.es/proposal-temporal/docs/) is a modern date and
time API available in the global scope. It provides better support for time
zones, calendars, and more precise date/time calculations than the legacy `Date`
object.

```ts title="example.ts"
// Example using Temporal API
// Get the current date and time
const now = Temporal.Now.plainDateTimeISO();
console.log(`Current date and time: ${now}`);

Expand All @@ -269,7 +261,3 @@ console.log(`Next week: ${nextWeek}`);
const zonedDateTime = Temporal.Now.zonedDateTimeISO("America/New_York");
console.log(`Time in New York: ${zonedDateTime}`);
```

Note that the Temporal API is still experimental and the specification may
change before it becomes stable. Use this flag only for testing and
experimentation.