]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
[locale] hr: Fix month declension in Croation LL, LLL, LLLL formats (#5152)
authorRoan Kattouw <roan.kattouw@gmail.com>
Thu, 23 Apr 2020 20:08:07 +0000 (13:08 -0700)
committerGitHub <noreply@github.com>
Thu, 23 Apr 2020 20:08:07 +0000 (23:08 +0300)
Months should be in the accusative case in these formats, but they are
returned in the nominative case. This is because these formats hard-code
the dot after the day ("D.") rather than using ordinal notation ("Do").
The regex for detecting accusative case matches "Do" but not "D.".

Many other locales have the same problem, with L* formats using "D."
where "Do" should be used instead, but none of them have different
grammatical forms for months, so nothing breaks for them. Croatian is
the only one where "D." causes this bug.

Downstream bug report from Wikipedia: https://phabricator.wikimedia.org/T223988

src/locale/hr.js
src/test/locale/hr.js

index 188b8c3a5598867af7bde99c069c3c6b301c25b5..4e49b41dd80d58adc1951d7b514e6a589b668edd 100644 (file)
@@ -81,9 +81,9 @@ export default moment.defineLocale('hr', {
         LT : 'H:mm',
         LTS : 'H:mm:ss',
         L : 'DD.MM.YYYY',
-        LL : 'D. MMMM YYYY',
-        LLL : 'D. MMMM YYYY H:mm',
-        LLLL : 'dddd, D. MMMM YYYY H:mm'
+        LL : 'Do MMMM YYYY',
+        LLL : 'Do MMMM YYYY H:mm',
+        LLLL : 'dddd, Do MMMM YYYY H:mm'
     },
     calendar : {
         sameDay  : '[danas u] LT',
index 66823616c7ff4b5e5665b9393a803c06cda76a19..9d0bca67f90843aac291f2e001264c6223231e1d 100644 (file)
@@ -39,9 +39,9 @@ test('format', function (assert) {
             ['[the] DDDo [day of the year]',       'the 45. day of the year'],
             ['LTS',                                '15:25:50'],
             ['L',                                  '14.02.2010'],
-            ['LL',                                 '14. veljača 2010'],
-            ['LLL',                                '14. veljača 2010 15:25'],
-            ['LLLL',                               'nedjelja, 14. veljača 2010 15:25'],
+            ['LL',                                 '14. veljače 2010'],
+            ['LLL',                                '14. veljače 2010 15:25'],
+            ['LLLL',                               'nedjelja, 14. veljače 2010 15:25'],
             ['l',                                  '14.2.2010'],
             ['ll',                                 '14. velj. 2010'],
             ['lll',                                '14. velj. 2010 15:25'],