]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Add a special case for years in Hebrew locale
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Tue, 9 Dec 2014 00:26:07 +0000 (02:26 +0200)
committerIskren Chernev <iskren.chernev@gmail.com>
Wed, 24 Dec 2014 21:27:49 +0000 (13:27 -0800)
In Hebrew years that end with a zero except 10 (20, 30, 100, etc.)
use a different plural form, which is identical to the singular.

I added this form.

This is also used by the CLDR plural rules.

locale/he.js
test/locale/he.js

index 9f9f470513efb287ddbf80f976484cf1c320ca52..5a52c4ab8f61bdd0ca0e0225a3109f26ef85ed6f 100644 (file)
@@ -71,6 +71,9 @@
                 if (number === 2) {
                     return 'שנתיים';
                 }
+                if (number % 10 === 0 && number !== 10) {
+                    return number + ' שנה';
+                }
                 return number + ' שנים';
             }
         }
index 84253f7bd4f7c8a334aaf0d97e31f9aaf92a1c23..74b08d71469cc50466fbda8de619ab5f1548443b 100644 (file)
@@ -116,6 +116,8 @@ exports['locale:he'] = {
         test.equal(start.from(moment([2007, 1, 28]).add({M: 5}), true),   '5 חודשים',      '5 months = 5 months');
         test.equal(start.from(moment([2007, 1, 28]).add({d: 345}), true), 'שנה',        '345 days = a year');
         test.equal(start.from(moment([2007, 1, 28]).add({d: 548}), true), 'שנתיים',       '548 days = 2 years');
+        test.equal(start.from(moment([2007, 1, 28]).add({d: 3699}), true), '10 שנים',        '345 days = 10 years');
+        test.equal(start.from(moment([2007, 1, 28]).add({d: 7340}), true), '20 שנה',       '548 days = 20 years');
         test.equal(start.from(moment([2007, 1, 28]).add({y: 1}), true),   'שנה',        '1 year = a year');
         test.equal(start.from(moment([2007, 1, 28]).add({y: 5}), true),   '5 שנים',       '5 years = 5 years');
         test.done();