Skip to content

test: set locale for datetime-change-notify test - #38741

Closed
Lxxyx wants to merge 1 commit into
nodejs:masterfrom
Lxxyx:fix-datetime-test
Closed

test: set locale for datetime-change-notify test#38741
Lxxyx wants to merge 1 commit into
nodejs:masterfrom
Lxxyx:fix-datetime-test

Conversation

@Lxxyx

@LxxyxLxxyx commented May 20, 2021

Copy link
Copy Markdown
Member

The time zone output by toString() will change with user's language, use toLocaleString() to set the time zone.

This test will fail on a computer with the language set to Chinese.

Example:

use toString()

newDate().toString()// output: Thu May 20 2021 05:18:38 GMT+0000 (协调世界时)

use toLocaleString()

newDate().toLocaleString('en-US',{timeZoneName: 'long'});// output: date 5/20/2021, 5:24:25 AM Coordinated Universal Time

The time zone output by toString() will change with user's language, use toLocaleString() to set the time zone.
@github-actionsgithub-actionsBot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels May 20, 2021
@LxxyxLxxyx added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. and removed needs-ci PRs that need a full CI run. labels May 21, 2021
@nodejs-github-bot

nodejs-github-bot commented May 21, 2021

Copy link
Copy Markdown
Collaborator

@jasnelljasnell added the fast-track PRs that do not need to wait for 48 hours to land. label May 21, 2021
@github-actions

Copy link
Copy Markdown
Contributor

Fast-track has been requested by @jasnell. Please 👍 to approve.

@jasnell

Copy link
Copy Markdown
Member

Landed in 80ed0a6

@jasnelljasnell closed this May 24, 2021
jasnell pushed a commit that referenced this pull request May 24, 2021
The time zone output by toString() will change with user's
language, use toLocaleString() to set the time zone.
PR-URL: #38741
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
danielleadams pushed a commit that referenced this pull request May 31, 2021
The time zone output by toString() will change with user's
language, use toLocaleString() to set the time zone.
PR-URL: #38741
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
@danielleadamsdanielleadams mentioned this pull request May 31, 2021
@richardlau

Copy link
Copy Markdown
Member

Depends on #38642.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.fast-trackPRs that do not need to wait for 48 hours to land.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Lxxyx@nodejs-github-bot@jasnell@richardlau