Skip to content

Commit

Permalink
fix locale defaulting and bump verson
Browse files Browse the repository at this point in the history
  • Loading branch information
icambron committed Aug 8, 2021
1 parent af749eb commit 4520463
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.2 (2021-08-08)

Fix locale defaulting

## 2.0.0 (2021-07-3)

See [Upgrading section](https://github.com/moment/luxon#upgrading-to-20) in README.md
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "luxon",
"version": "2.0.1",
"version": "2.0.2",
"description": "Immutable date wrapper",
"author": "Isaac Cambron",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion scripts/repl
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
NODE_ICU_DATA="$(pwd)/node_modules/full-icu" LANG=en_US.utf8 node -i -r "./scripts/bootstrap.js"
LANG=en-US.utf8 node -i -r "./scripts/bootstrap.js"
12 changes: 6 additions & 6 deletions src/impl/locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function systemLocale() {
if (sysLocaleCache) {
return sysLocaleCache;
} else {
sysLocaleCache = "en-US";
sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;
return sysLocaleCache;
}
}
Expand Down Expand Up @@ -265,11 +265,11 @@ export default class Locale {
}

static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {
const specifiedLocale = locale || Settings.defaultLocale,
// the system locale is useful for human readable strings but annoying for parsing/formatting known formats
localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()),
numberingSystemR = numberingSystem || Settings.defaultNumberingSystem,
outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
const specifiedLocale = locale || Settings.defaultLocale;
// the system locale is useful for human readable strings but annoying for parsing/formatting known formats
const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
}

Expand Down
2 changes: 1 addition & 1 deletion src/luxon.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import InvalidZone from "./zones/invalidZone.js";
import SystemZone from "./zones/systemZone.js";
import Settings from "./settings.js";

const VERSION = "2.0.1";
const VERSION = "2.0.2";

export {
VERSION,
Expand Down

0 comments on commit 4520463

Please sign in to comment.