fix(locale): use correct English ordinal in en-ca, en-ie, en-il, en-sg#3152
Open
greymoth-jp wants to merge 1 commit into
Open
fix(locale): use correct English ordinal in en-ca, en-ie, en-il, en-sg#3152greymoth-jp wants to merge 1 commit into
greymoth-jp wants to merge 1 commit into
Conversation
These four English-variant locales kept the placeholder ordinal n => n, so
format('Do') returned the bare day number ("21" instead of "21st"). The
other English locales (en, en-au, en-gb, en-in, en-nz, en-tt) already use
the standard English ordinal function; reuse it here so all English
variants agree. Matches moment's ordinal for these locales (see iamkun#2878).
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.
What
en-ca,en-ie,en-ilanden-sgstill carry the placeholderordinal: n => n, soformat('Do')returns the bare day number for them:(
Docomes from theadvancedFormatplugin.)The other English locales already define the standard English ordinal function:
en,en-au,en-gb,en-in,en-nz,en-tt. English ordinals (1st/2nd/3rd, 11th/21st) are the same across these regions, so the four locales above were simply missing the function rather than intentionally different. This is the same change #2878 made foren-au("Use the same ordinal as moment"); moment also defines the full ordinal foren-ca,en-ie,en-ilanden-sg.Fix
Reuse the existing English ordinal function in the four locales.
Test
Added an ordinal parity check in
test/locale/en.test.jsthat comparesformat('Do')against moment for days 1 to 31 in each of the four locales. It fails on the oldn => nand passes with the change. The fulljestsuite is green andeslintpasses.