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

lib: support setting process.env.TZ on windows #38642

Closed
wants to merge 2 commits into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented May 11, 2021

Fixes: #4230
Signed-off-by: James M Snell jasnell@gmail.com

Update: Even tho this is semver-patch, I'm marking it as a notable change for when it lands. The bug was first reported back in Dec 2015, it was closed for a while, one partial attempt at fixing it was made a couple of years ago, and this completes the fix.

/cc @targos @srl295

@github-actions github-actions bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels May 11, 2021
src/node_env_var.cc Outdated Show resolved Hide resolved
src/node_env_var.cc Outdated Show resolved Hide resolved
@srl295
Copy link
Member

srl295 commented May 12, 2021

Might just have NODE_DEFAULT_ZONE instead of trying to emulate TZ. don't use abbrevs just tz IDs like America/Los_Angeles.

@jasnell jasnell force-pushed the datetime-change-notify branch from f3f8c3a to e59351b Compare May 12, 2021 02:22
@jasnell
Copy link
Member Author

jasnell commented May 12, 2021

@srl295:

Might just have NODE_DEFAULT_ZONE instead of trying to emulate TZ.

In the current version of the PR, use of set TZ="..." does work. Is there a particular limitation here that would make it undesirable? What would using NODE_DEFAULT_ZONE give us? My concern would be introducing something that is inconsistent with TZ on non-windows systems.

@jasnell jasnell marked this pull request as ready for review May 12, 2021 02:25
@srl295
Copy link
Member

srl295 commented May 12, 2021

@srl295:

Might just have NODE_DEFAULT_ZONE instead of trying to emulate TZ.

In the current version of the PR, use of set TZ="..." does work. Is there a particular limitation here that would make it undesirable? What would using NODE_DEFAULT_ZONE give us? My concern would be introducing something that is inconsistent with TZ on non-windows systems.

What matt was alluding to is that it's already inconsistent. Posix does a bunch of other processing. Node-default-zone would make it clear we are simply choosing a new default zone by the full id rather than trying To emulate Posix TZ on windows.

Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

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

I'll say lgtm with caveats that it will not be === TZ behavior on posix, suggestions as noted in thread.

@jasnell
Copy link
Member Author

jasnell commented May 12, 2021

I'll say lgtm with caveats that it will not be === TZ behavior on posix, suggestions as noted in thread.

Understood. I think those differences will be ok here. I'll try to find a good place to describe those differences in the docs

@nodejs-github-bot

This comment has been minimized.

@srl295
Copy link
Member

srl295 commented May 12, 2021

I'll say lgtm with caveats that it will not be === TZ behavior on posix, suggestions as noted in thread.

Understood. I think those differences will be ok here. I'll try to find a good place to describe those differences in the docs

one reference: https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
ICU won't necessarily handle those completely either, but it will try to find a matching zone.
Perhaps something like this:

While the TZ env variable on Node.js won't handle all of the various ways that the TZ variable is handled in other environments, it will support tz ids (such as Etc/UTC, Europe/Paris or America/New_York. It may support a few other abbreviations or aliases, but these are strongly discouraged.

sorry not sorry for being a stick in the timezone mud :)

@jasnell jasnell force-pushed the datetime-change-notify branch 2 times, most recently from 3f15012 to cc783d2 Compare May 12, 2021 19:42
Copy link
Member

@srl295 srl295 left a comment

Choose a reason for hiding this comment

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

🇮🇪

@jasnell jasnell force-pushed the datetime-change-notify branch from cc783d2 to 9d30626 Compare May 12, 2021 19:50
@nodejs-github-bot

This comment has been minimized.

@jasnell jasnell force-pushed the datetime-change-notify branch from 9d30626 to 311265a Compare May 12, 2021 20:11
src/node_i18n.cc Outdated Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

doc/api/cli.md Outdated Show resolved Hide resolved
@jasnell jasnell force-pushed the datetime-change-notify branch from abcc357 to 4793754 Compare May 13, 2021 03:34
@jasnell jasnell requested a review from addaleax May 13, 2021 03:35
@nodejs-github-bot

This comment has been minimized.

doc/api/cli.md Outdated Show resolved Hide resolved
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

Fixes: nodejs#4230
Signed-off-by: James M Snell <jasnell@gmail.com>
@jasnell jasnell force-pushed the datetime-change-notify branch from 5fd73e8 to b6a0fac Compare May 14, 2021 01:17
@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@nodejs-github-bot

This comment has been minimized.

@srl295 srl295 added the i18n-api Issues and PRs related to the i18n implementation. label May 14, 2021
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented May 14, 2021

@jasnell
Copy link
Member Author

jasnell commented May 17, 2021

Landed in 16cb4f7

@jasnell jasnell closed this May 17, 2021
jasnell added a commit that referenced this pull request May 17, 2021
Fixes: #4230
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #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>
@jasnell jasnell added the notable-change PRs with changes that should be highlighted in changelogs. label May 17, 2021
targos pushed a commit that referenced this pull request May 18, 2021
Fixes: #4230
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #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>
targos added a commit that referenced this pull request May 18, 2021
Notable changes:

async_hooks:
  * (SEMVER-MINOR) use new v8::Context PromiseHook API (Stephen Belanger) #36394
lib:
  * support setting process.env.TZ on windows (James M Snell) #38642
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
process:
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
util:
  * (SEMVER-MINOR) add util.types.isKeyObject and util.types.isCryptoKey (Filip Skokan) #38619

PR-URL: #38719
targos added a commit that referenced this pull request May 18, 2021
Notable changes:

async_hooks:
  * (SEMVER-MINOR) use new v8::Context PromiseHook API (Stephen Belanger) #36394
lib:
  * support setting process.env.TZ on windows (James M Snell) #38642
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
process:
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
util:
  * (SEMVER-MINOR) add util.types.isKeyObject and util.types.isCryptoKey (Filip Skokan) #38619

PR-URL: #38719
targos added a commit that referenced this pull request May 19, 2021
Notable changes:

async_hooks:
  * (SEMVER-MINOR) use new v8::Context PromiseHook API (Stephen Belanger) #36394
lib:
  * support setting process.env.TZ on windows (James M Snell) #38642
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
process:
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
util:
  * (SEMVER-MINOR) add util.types.isKeyObject and util.types.isCryptoKey (Filip Skokan) #38619

PR-URL: #38719
targos added a commit that referenced this pull request May 19, 2021
Notable changes:

async_hooks:
  * (SEMVER-MINOR) use new v8::Context PromiseHook API (Stephen Belanger) #36394
lib:
  * support setting process.env.TZ on windows (James M Snell) #38642
module:
  * (SEMVER-MINOR) add support for `URL` to `import.meta.resolve` (Antoine du Hamel) #38587
process:
  * (SEMVER-MINOR) add `'worker'` event (James M Snell) #38659
util:
  * (SEMVER-MINOR) add util.types.isKeyObject and util.types.isCryptoKey (Filip Skokan) #38619

PR-URL: #38719
codebytere added a commit to electron/electron that referenced this pull request May 19, 2021
codebytere added a commit to electron/electron that referenced this pull request May 20, 2021
codebytere added a commit to electron/electron that referenced this pull request May 31, 2021
codebytere added a commit to electron/electron that referenced this pull request May 31, 2021
codebytere added a commit to electron/electron that referenced this pull request Jun 8, 2021
codebytere added a commit to electron/electron that referenced this pull request Jun 9, 2021
codebytere added a commit to electron/electron that referenced this pull request Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. i18n-api Issues and PRs related to the i18n implementation. notable-change PRs with changes that should be highlighted in changelogs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I can't set a default timezone on windows.
7 participants