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

Setting Environment variable TZ does not affect Date.getTimezoneOffset() #6091

Open
jpravetz opened this issue Oct 4, 2024 · 0 comments
Open
Labels
bug Something isn't working needs triage

Comments

@jpravetz
Copy link

jpravetz commented Oct 4, 2024

Datetime timezoneoffset has not been implemented?

Run this script with deno (can use process.env.TZ or Deno.env.set method):

import process from 'node:process';
const now = new Date();
console.log(now.getTimezoneOffset(), 'default');
['America/Costa_Rica', 'EST', 'America/St_Johns', 'UTC', 'America/Vancouver', 'Australia/Adelaide'].forEach(
  (tz) => {
    process.env.TZ = tz;
    console.log(now.getTimezoneOffset(), tz);
  }
);

Actual output:

360 default
360 America/Costa_Rica
360 EST
360 America/St_Johns
360 UTC
360 America/Vancouver
360 Australia/Adelaide

Then run this with node:

const process = require('node:process');
const now = new Date();
console.log(now.getTimezoneOffset(), 'default');
['America/Costa_Rica', 'EST', 'America/St_Johns', 'UTC', 'America/Vancouver', 'Australia/Adelaide'].forEach(
  (tz) => {
    process.env.TZ = tz;
    console.log(now.getTimezoneOffset(), tz);
  }
);
360 default
360 America/Costa_Rica
300 EST
150 America/St_Johns
0 UTC
420 America/Vancouver
-570 Australia/Adelaide

Looks like feature not implemented?

@jpravetz jpravetz added bug Something isn't working needs triage labels Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

1 participant