Skip to content

Conversation

@littledivy
Copy link
Member

Fixes #18623

Intercepts the assignment to TZ env var and updates tz cache. Matches Node's behaviour (ref)

import process from "node:process"

console.log(new Date().toString());
process.env.TZ = 'Asia/Tokyo';
console.log(new Date().toString());
Sun Jan 26 2025 10:00:47 GMT+0530 (India Standard Time)
Sun Jan 26 2025 13:30:47 GMT+0900 (Japan Standard Time)

Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test that uses Deno.env API too?

@petamoriken
Copy link
Contributor

petamoriken commented Jan 26, 2025

IMHO, instead of using Deno.env.TZ according to process.env.TZ, it would be better to have a accessor property API e.g. Deno.timeZone.

My bad. Apparently it is already supported.
#11053 (comment)

@littledivy littledivy merged commit 5c64146 into denoland:main Jan 28, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set process.env.TZ has no effect

3 participants