]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
[locale] mr (Marathi) (#4990)
authorVinay Date <vinaydate@users.noreply.github.com>
Mon, 11 Feb 2019 22:57:06 +0000 (04:27 +0530)
committerKunal Marwaha <marwahaha@berkeley.edu>
Mon, 11 Feb 2019 22:57:06 +0000 (14:57 -0800)
* tests according to changes in mr.js

* [locale] mr (Marathi)

We Marathi people follow standards mentioned below, to label timespans.

Label | Time Span
------------ | -------------
पहाटे (post midnight, pre-sunrise) |    >= 12am to < 6am
सकाळी (post sunrise, pre-noon) |    >= 6am to < 12pm
दुपारी (afternoon) |    >= 12pm to < 5pm
सायंकाळी (evening) |    >= 5pm to < 8pm
रात्री (night) |    >= 8pm to < 12am

Actually, 12am is confusing in Marathi tradition. In modern clock system, Moment 12am is considered in arriving date as 0am. And in Marathi tradition it is referred to as final moment of the previous date (Sort of, 0:01 is starting minute of the arriving date) . To comply with modern clock system, I propose to refer to 0am as पहाटे , so that it is considered as moment in the arriving date. Hope this discription itself is not confusing :)

Another point is about range of पहाटे, ie. >= 0am to < 6am. Though conventionally, upto 2 am, we refer to the time as रात्री or पहाटे, both alternatively, I want to specifically call पहाटे for early times in the arriving date and रात्री for late times in the departing date, to make it more specific and well-defined, avoiding confusion about date of the time.

src/locale/mr.js
src/test/locale/mr.js

index 8086ba281dddea695775db7f945a4763bec79657..49f39ce8f9ecca96626b0b3a8aeda112a70b00a8 100644 (file)
@@ -117,25 +117,21 @@ export default moment.defineLocale('mr', {
             return symbolMap[match];
         });
     },
-    meridiemParse: /रातà¥\8dरà¥\80|सà¤\95ाळà¥\80|दà¥\81पारà¥\80|सायà¤\82à¤\95ाळी/,
-    meridiemHour : function (hour, meridiem) {
+    meridiemParse: /पहाà¤\9fà¥\87|सà¤\95ाळà¥\80|दà¥\81पारà¥\80|सायà¤\82à¤\95ाळà¥\80|रातà¥\8dरी/,
+    meridiemHour: function (hour, meridiem) {
         if (hour === 12) {
             hour = 0;
         }
-        if (meridiem === 'रात्री') {
-            return hour < 4 ? hour : hour + 12;
-        } else if (meridiem === 'सकाळी') {
+        if (meridiem === 'पहाटे' || meridiem === 'सकाळी') {
             return hour;
-        } else if (meridiem === 'दुपारी') {
-            return hour >= 10 ? hour : hour + 12;
-        } else if (meridiem === 'सायंकाळी') {
-            return hour + 12;
+        } else if (meridiem === 'दुपारी' || meridiem === 'सायंकाळी' || meridiem === 'रात्री') {
+            return hour >= 12 ? hour : hour + 12;
         }
     },
     meridiem: function (hour, minute, isLower) {
-        if (hour < 4) {
-            return 'रातà¥\8dरà¥\80';
-        } else if (hour < 10) {
+        if (hour >= 0 && hour < 6) {
+            return 'पहाà¤\9fà¥\87';
+        } else if (hour < 12) {
             return 'सकाळी';
         } else if (hour < 17) {
             return 'दुपारी';
@@ -150,4 +146,3 @@ export default moment.defineLocale('mr', {
         doy : 6  // The week that contains Jan 6th is the first week of the year.
     }
 });
-
index c505ae43be8a1e054627a287a84d7e4881f6f4e3..2baa3c82c1fee13263915134da21729b707a15ca 100644 (file)
@@ -157,7 +157,7 @@ test('calendar day', function (assert) {
     assert.equal(moment(a).add({m: 25}).calendar(),      'आज दुपारी १२:२५ वाजता',    'Now plus 25 min');
     assert.equal(moment(a).add({h: 3}).calendar(),       'आज दुपारी ३:०० वाजता',     'Now plus 3 hours');
     assert.equal(moment(a).add({d: 1}).calendar(),       'उद्या दुपारी १२:०० वाजता', 'tomorrow at the same time');
-    assert.equal(moment(a).subtract({h: 1}).calendar(),  'à¤\86à¤\9c à¤¦à¥\81पारी ११:०० वाजता',    'Now minus 1 hour');
+    assert.equal(moment(a).subtract({h: 1}).calendar(),  'à¤\86à¤\9c à¤¸à¤\95ाळी ११:०० वाजता',    'Now minus 1 hour');
     assert.equal(moment(a).subtract({d: 1}).calendar(),  'काल दुपारी १२:०० वाजता',   'yesterday at the same time');
 });
 
@@ -201,14 +201,14 @@ test('calendar all else', function (assert) {
 });
 
 test('meridiem', function (assert) {
-    assert.equal(moment([2011, 2, 23,  2, 30]).format('a'), 'रातà¥\8dरà¥\80', 'before dawn');
+    assert.equal(moment([2011, 2, 23,  2, 30]).format('a'), 'पहाà¤\9fà¥\87', 'before dawn');
     assert.equal(moment([2011, 2, 23,  9, 30]).format('a'), 'सकाळी', 'morning');
     assert.equal(moment([2011, 2, 23, 14, 30]).format('a'), 'दुपारी', 'during day');
     assert.equal(moment([2011, 2, 23, 17, 30]).format('a'), 'सायंकाळी', 'evening');
     assert.equal(moment([2011, 2, 23, 19, 30]).format('a'), 'सायंकाळी', 'late evening');
     assert.equal(moment([2011, 2, 23, 21, 20]).format('a'), 'रात्री', 'night');
 
-    assert.equal(moment([2011, 2, 23,  2, 30]).format('A'), 'रातà¥\8dरà¥\80', 'before dawn');
+    assert.equal(moment([2011, 2, 23,  2, 30]).format('A'), 'पहाà¤\9fà¥\87', 'before dawn');
     assert.equal(moment([2011, 2, 23,  9, 30]).format('A'), 'सकाळी', 'morning');
     assert.equal(moment([2011, 2, 23, 14, 30]).format('A'), 'दुपारी', ' during day');
     assert.equal(moment([2011, 2, 23, 17, 30]).format('A'), 'सायंकाळी', 'evening');