Skip to content

Fix default fallbacks to "en" everywhere - #98

Merged
borgar merged 3 commits into
masterfrom
fix-default-fallbacks
Oct 17, 2026
Merged

borgar merged 3 commits into
masterfrom
fix-default-fallbacks

Conversation

@borgar

@borgar borgar commented Oct 17, 2026 •

Copy link
Copy Markdown
Owner

Without a locale, every function now uses the built-in en locale.

Before, the defaults disagreed. parseValue used en-US, while parseDate, parseNumber, parseTime, and parseBool did not. format() used hard-coded patterns for the system date and time codes.

  • defaultLocale is now the built-in en locale, so unknown locale tags also fall back to en.
  • getLocale() accepts undefined and an empty string, and returns undefined for them.
  • delocalize() falls back to en for an unknown locale.

A side effect to this that I had to fix is that:

A/P prints A or P in every locale

A/P printed a single letter only when no locale was given. With any locale, including en-US, it printed the locale's full AM/PM names. It now always prints A or P, as Excel does.

A driveby fix: Regexp matcher for TOKEN_MODIFIER was incorrect. This doesn't affect much since formats that this happens in would have yielded errors anyway.

Fixes #97

@borgar
borgar merged commit c639601 into master Oct 17, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parseDate without a locale reads numeric dates day first (3.x read month first)

1 participant