Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/node): clear tz cache when setting process.env.TZ #27826

Merged
merged 3 commits into from
Jan 28, 2025

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