fix: Deal with undetected timeZone in Stats.js #9799
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As seen in facebook/create-react-app#7783 (comment) (and GoogleChrome/lighthouse#1056 and others) if for some reasons the
timeZone
is undetected the locale-methods throw with "RangeError: Unsupported time zone specified undefined"The issue itself was fixed in NodeJS 12, but affects other NodeJS LTS versions (6, 8, 10)
What kind of change does this PR introduce?
This PR deals with the issue similar to https://github.com/GoogleChrome/lighthouse/pull/1086/files and https://github.com/GoogleChrome/lighthouse/pull/1086/files
Did you add tests for your changes?
This is bit tricky to test this as it needs OS level changes or ENV variable setup at launch but manual steps to test this is
then reverse this check so that the locale time strings are run on the basic tests
then run the basic tests
See all the snapshot tests failing 馃憖 and then run the tests again with Etc/Unknown timezone
Expected:
Actual:
Apply the changes from this branch to confirm that the issue was fixed.
Does this PR introduce a breaking change?
Nope, it just fixes an unfortunate edge case
What needs to be documented once your changes are merged?
No need for doc changes
Signed-off-by: petetnt pete.a.nykanen@gmail.com