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

🐛 BUG: RangeError: Incorrect locale information provided #3309

Closed
1 task done
UpperCod opened this issue May 6, 2022 · 5 comments · Fixed by #3391 or #3400
Closed
1 task done

🐛 BUG: RangeError: Incorrect locale information provided #3309

UpperCod opened this issue May 6, 2022 · 5 comments · Fixed by #3391 or #3400
Assignees
Labels
- P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)

Comments

@UpperCod
Copy link

UpperCod commented May 6, 2022

What version of astro are you using?

1.0.0-beta.24

Are you using an SSR adapter? If so, which one?

None

What package manager are you using?

npm

What operating system are you using?

Windows

Describe the Bug

Running Astro generates the following error:

RangeError: Incorrect locale information provided
    at new DateTimeFormat (<anonymous>)
    at file:///C:/git/atomico/plugin-astro/node_modules/astro/dist/core/logger/core.js:15:24
    at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
    at async Promise.all (index 0)
    at async ESMLoader.import (node:internal/modules/esm/loader:409:24)

This error occurs because node generates the process.en.LANG with the following code es_419.UTF-8, which is incompatible with the result of getLoggerLocale when instantiating Intl.DateTimeFormat in:

const dateTimeFormat = new Intl.DateTimeFormat(getLoggerLocale(), {
  hour: "2-digit",
  minute: "2-digit",
  second: "2-digit"
});

Reproduction is complex since this is a Node variable depending on the region of the installation, in my case country Chile

Link to Minimal Reproducible Example

https://github.com/UpperCod/atomico-astro

Participation

  • I am willing to submit a pull request for this issue.
@UpperCod
Copy link
Author

UpperCod commented May 6, 2022

invalid solution:

The bug can be patched as follows:
1. Open time settings in windows
2. Time and language > Region and language
3. Change regional format to `Español (International)

@natemoo-re natemoo-re added s1-small - P4: important Violate documented behavior or significantly impacts performance (priority) and removed bb:investigate labels May 10, 2022
@natemoo-re
Copy link
Member

Sorry for the frustration! This is a pretty critical issue but should be pretty small to fix. We should definitely take a look at this soon.

@UpperCod
Copy link
Author

Hi, the solution that I have attached is not valid, this affects Windows 11 users with international Spanish (or that is my case).

I am attentive to the solution and to what you need

@FredKSchott FredKSchott added - P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority) and removed - P4: important Violate documented behavior or significantly impacts performance (priority) labels May 12, 2022
@tanepiper
Copy link

I've just had this affect a colleague, her machine was in Colombian Spanish while I'm in UK English.

natemoo-re pushed a commit that referenced this issue May 17, 2022
natemoo-re pushed a commit that referenced this issue May 18, 2022
natemoo-re added a commit that referenced this issue May 18, 2022
* fix(#3309): use system default locale

* fix(#3309): use system default locale in create-astro

* test: add locale regression tests

* test: add i18n regression test
@natemoo-re
Copy link
Member

Thanks for opening an issue—this is fixed in the next release of Astro!

We've also added some regression tests to ensure this doesn't happen in the future.

@github-actions github-actions bot mentioned this issue May 18, 2022
SiriousHunter pushed a commit to SiriousHunter/astro that referenced this issue Feb 3, 2023
* fix(withastro#3309): use system default locale

* fix(withastro#3309): use system default locale in create-astro

* test: add locale regression tests

* test: add i18n regression test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P5: urgent Fix build-breaking bugs affecting most users, should be released ASAP (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants