node/test/parallel/test-datetime-change-notify.js
James M Snell 16cb4f720b
lib: support setting process.env.TZ on windows
Fixes: https://github.com/nodejs/node/issues/4230
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/38642
Reviewed-By: Steven R Loomis <srloomis@us.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2021-05-17 12:02:49 -07:00

25 lines
661 B
JavaScript

'use strict';
const common = require('../common');
const { isMainThread } = require('worker_threads');
if (!common.hasIntl)
common.skip('Intl not present.');
if (!isMainThread)
common.skip('Test not support running within a worker');
const assert = require('assert');
process.env.TZ = 'Etc/UTC';
assert.match(new Date().toString(), /GMT\+0000/);
process.env.TZ = 'America/New_York';
assert.match(new Date().toString(), /Eastern (Standard|Daylight) Time/);
process.env.TZ = 'America/Los_Angeles';
assert.match(new Date().toString(), /Pacific (Standard|Daylight) Time/);
process.env.TZ = 'Europe/Dublin';
assert.match(new Date().toString(), /Irish/);