You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

122 lines
4.0 KiB

//! moment.js locale configuration
//! locale : Gujarati [gu]
//! author : Kaushik Thanki : https://github.com/Kaushik1987
import moment from '../moment';
var symbolMap = {
1: '૧',
2: '૨',
3: '૩',
4: '૪',
5: '૫',
6: '૬',
7: '૭',
8: '૮',
9: '૯',
0: '૦',
},
numberMap = {
'૧': '1',
'૨': '2',
'૩': '3',
'૪': '4',
'૫': '5',
'૬': '6',
'૭': '7',
'૮': '8',
'૯': '9',
'૦': '0',
};
export default moment.defineLocale('gu', {
months: 'જઆર_ફઆર_મચ_એપિલ_મ_જન_જઈ_ઑગસટ_સપબર_ઑકબર_નવબર_ડિબર'.split(
'_'
),
monthsShort:
'જ._ફ._મચ_એપિ._મ_જન_જ._ઑગ._સપ._ઑક._નવ._ડિ.'.split(
'_'
),
monthsParseExact: true,
weekdays: 'રવિર_સમવર_મગળવર_બર_ગર_શરવર_શનિર'.split(
'_'
),
weekdaysShort: 'રવિ_સમ_મગળ_બ_ગ_શર_શનિ'.split('_'),
weekdaysMin: 'ર_સ_મ_બ_ગ_શ_શ'.split('_'),
longDateFormat: {
LT: 'A h:mm વ',
LTS: 'A h:mm:ss વ',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY, A h:mm વ',
LLLL: 'dddd, D MMMM YYYY, A h:mm વ',
},
calendar: {
sameDay: '[આજ] LT',
nextDay: '[ક] LT',
nextWeek: 'dddd, LT',
lastDay: '[ગઇક] LT',
lastWeek: '[પછલ] dddd, LT',
sameElse: 'L',
},
relativeTime: {
future: '%s મ',
past: '%s પહ',
s: 'અમક પળ',
ss: '%d સડ',
m: 'એક મિિટ',
mm: '%d મિિટ',
h: 'એક કલક',
hh: '%d કલક',
d: 'એક દિવસ',
dd: '%d દિવસ',
M: 'એક મહિ',
MM: '%d મહિ',
y: 'એક વરષ',
yy: '%d વરષ',
},
preparse: function (string) {
return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) {
return numberMap[match];
});
},
postformat: function (string) {
return string.replace(/\d/g, function (match) {
return symbolMap[match];
});
},
// Gujarati notation for meridiems are quite fuzzy in practice. While there exists
// a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati.
meridiemParse: /રત|બપર|સવર|સજ/,
meridiemHour: function (hour, meridiem) {
if (hour === 12) {
hour = 0;
}
if (meridiem === 'રત') {
return hour < 4 ? hour : hour + 12;
} else if (meridiem === 'સવર') {
return hour;
} else if (meridiem === 'બપર') {
return hour >= 10 ? hour : hour + 12;
} else if (meridiem === 'સજ') {
return hour + 12;
}
},
meridiem: function (hour, minute, isLower) {
if (hour < 4) {
return 'રત';
} else if (hour < 10) {
return 'સવર';
} else if (hour < 17) {
return 'બપર';
} else if (hour < 20) {
return 'સજ';
} else {
return 'રત';
}
},
week: {
dow: 0, // Sunday is the first day of the week.
doy: 6, // The week that contains Jan 6th is the first week of the year.
},
});