UNPKG

6.57 kBJavaScriptView Raw
1//! moment.js locale configuration
2//! locale : Marathi [mr]
3//! author : Harshad Kale : https://github.com/kalehv
4//! author : Vivek Athalye : https://github.com/vnathalye
5
6import moment from '../moment';
7
8var symbolMap = {
9 1: '१',
10 2: '२',
11 3: '३',
12 4: '४',
13 5: '५',
14 6: '६',
15 7: '७',
16 8: '८',
17 9: '९',
18 0: '०',
19 },
20 numberMap = {
21 '१': '1',
22 '२': '2',
23 '३': '3',
24 '४': '4',
25 '५': '5',
26 '६': '6',
27 '७': '7',
28 '८': '8',
29 '९': '9',
30 '०': '0',
31 };
32
33function relativeTimeMr(number, withoutSuffix, string, isFuture) {
34 var output = '';
35 if (withoutSuffix) {
36 switch (string) {
37 case 's':
38 output = 'काही सेकंद';
39 break;
40 case 'ss':
41 output = '%d सेकंद';
42 break;
43 case 'm':
44 output = 'एक मिनिट';
45 break;
46 case 'mm':
47 output = '%d मिनिटे';
48 break;
49 case 'h':
50 output = 'एक तास';
51 break;
52 case 'hh':
53 output = '%d तास';
54 break;
55 case 'd':
56 output = 'एक दिवस';
57 break;
58 case 'dd':
59 output = '%d दिवस';
60 break;
61 case 'M':
62 output = 'एक महिना';
63 break;
64 case 'MM':
65 output = '%d महिने';
66 break;
67 case 'y':
68 output = 'एक वर्ष';
69 break;
70 case 'yy':
71 output = '%d वर्षे';
72 break;
73 }
74 } else {
75 switch (string) {
76 case 's':
77 output = 'काही सेकंदां';
78 break;
79 case 'ss':
80 output = '%d सेकंदां';
81 break;
82 case 'm':
83 output = 'एका मिनिटा';
84 break;
85 case 'mm':
86 output = '%d मिनिटां';
87 break;
88 case 'h':
89 output = 'एका तासा';
90 break;
91 case 'hh':
92 output = '%d तासां';
93 break;
94 case 'd':
95 output = 'एका दिवसा';
96 break;
97 case 'dd':
98 output = '%d दिवसां';
99 break;
100 case 'M':
101 output = 'एका महिन्या';
102 break;
103 case 'MM':
104 output = '%d महिन्यां';
105 break;
106 case 'y':
107 output = 'एका वर्षा';
108 break;
109 case 'yy':
110 output = '%d वर्षां';
111 break;
112 }
113 }
114 return output.replace(/%d/i, number);
115}
116
117export default moment.defineLocale('mr', {
118 months: 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split(
119 '_'
120 ),
121 monthsShort:
122 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split(
123 '_'
124 ),
125 monthsParseExact: true,
126 weekdays: 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
127 weekdaysShort: 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'),
128 weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'),
129 longDateFormat: {
130 LT: 'A h:mm वाजता',
131 LTS: 'A h:mm:ss वाजता',
132 L: 'DD/MM/YYYY',
133 LL: 'D MMMM YYYY',
134 LLL: 'D MMMM YYYY, A h:mm वाजता',
135 LLLL: 'dddd, D MMMM YYYY, A h:mm वाजता',
136 },
137 calendar: {
138 sameDay: '[आज] LT',
139 nextDay: '[उद्या] LT',
140 nextWeek: 'dddd, LT',
141 lastDay: '[काल] LT',
142 lastWeek: '[मागील] dddd, LT',
143 sameElse: 'L',
144 },
145 relativeTime: {
146 future: '%sमध्ये',
147 past: '%sपूर्वी',
148 s: relativeTimeMr,
149 ss: relativeTimeMr,
150 m: relativeTimeMr,
151 mm: relativeTimeMr,
152 h: relativeTimeMr,
153 hh: relativeTimeMr,
154 d: relativeTimeMr,
155 dd: relativeTimeMr,
156 M: relativeTimeMr,
157 MM: relativeTimeMr,
158 y: relativeTimeMr,
159 yy: relativeTimeMr,
160 },
161 preparse: function (string) {
162 return string.replace(/[१२३४५६७८९०]/g, function (match) {
163 return numberMap[match];
164 });
165 },
166 postformat: function (string) {
167 return string.replace(/\d/g, function (match) {
168 return symbolMap[match];
169 });
170 },
171 meridiemParse: /पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,
172 meridiemHour: function (hour, meridiem) {
173 if (hour === 12) {
174 hour = 0;
175 }
176 if (meridiem === 'पहाटे' || meridiem === 'सकाळी') {
177 return hour;
178 } else if (
179 meridiem === 'दुपारी' ||
180 meridiem === 'सायंकाळी' ||
181 meridiem === 'रात्री'
182 ) {
183 return hour >= 12 ? hour : hour + 12;
184 }
185 },
186 meridiem: function (hour, minute, isLower) {
187 if (hour >= 0 && hour < 6) {
188 return 'पहाटे';
189 } else if (hour < 12) {
190 return 'सकाळी';
191 } else if (hour < 17) {
192 return 'दुपारी';
193 } else if (hour < 20) {
194 return 'सायंकाळी';
195 } else {
196 return 'रात्री';
197 }
198 },
199 week: {
200 dow: 0, // Sunday is the first day of the week.
201 doy: 6, // The week that contains Jan 6th is the first week of the year.
202 },
203});