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.

123 lines
4.1 KiB

//! moment.js locale configuration
//! locale : Punjabi (India) [pa-in]
//! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit
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('pa-in', {
// There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi.
months: 'ਜਨਵਰ_ਫਰਵਰ_ਮਰਚ_ਅਪਲ_ਮਈ_ਜਨ_ਜਈ_ਅਗਸਤ_ਸਤਬਰ_ਅਕਤਬਰ_ਨਵਬਰ_ਦਸਬਰ'.split(
'_'
),
monthsShort:
'ਜਨਵਰ_ਫਰਵਰ_ਮਰਚ_ਅਪਲ_ਮਈ_ਜਨ_ਜਈ_ਅਗਸਤ_ਸਤਬਰ_ਅਕਤਬਰ_ਨਵਬਰ_ਦਸਬਰ'.split(
'_'
),
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];
});
},
// Punjabi 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 Punjabi.
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.
},
});