fix: preserve instance scope when resolving fallback locales - #3189
Open
OskarEichler wants to merge 1 commit into
Open
fix: preserve instance scope when resolving fallback locales#3189OskarEichler wants to merge 1 commit into
OskarEichler wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes
dayjs().locale('en-US')must not change the global locale fromfrtoen.$Lundefined. This preserves the previous unknown-regional fallback and also handles unsupported non-regional constructor locales consistently.The recursive
parseLocalecall previously droppedisLocal. Forwarding it fixes the global mutation; the constructor fallback prevents a new formatting failure when neither the region nor its base language is registered.Reproduction
Compatibility
No public API, type, dependency, or minimum-runtime changes. Explicit global
dayjs.locale('en-US')still changes the global locale. Existing instances and date values remain unchanged. Unknown instance-local locales retain that instance's locale. Code relying on the accidental global mutation must call the global setter explicitly; unsupported constructor locales now safely use the global default.Verification
No test files were added or modified. The old size-limit Webpack dependency needs
NODE_OPTIONS=--openssl-legacy-providerunder Node 22; that was a verification-only setting, not a package change. Existing Handlebars coverage-report and Kurdish mixed-export warnings remain. CustomParseFormat's separate direct regional-language lookup is unchanged.