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.
 
 
 
 
 

168 lines
6.3 KiB

//! moment.js locale configuration
//! locale : Hindi [hi]
//! author : Mayank Singhal : https://github.com/mayanksinghal
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',
},
monthsParse = [
/^जन/i,
/^फर|फर/i,
/^मच/i,
/^अप/i,
/^मई/i,
/^जन/i,
/^जल/i,
/^अग/i,
/^सि|सित/i,
/^अक/i,
/^नव|नव/i,
/^दि|दिस/i,
],
shortMonthsParse = [
/^जन/i,
/^फर/i,
/^मच/i,
/^अप/i,
/^मई/i,
/^जन/i,
/^जल/i,
/^अग/i,
/^सित/i,
/^अक/i,
/^नव/i,
/^दिस/i,
];
export default moment.defineLocale('hi', {
months: {
format: 'जनवर_फरवर_मच_अपल_मई_जन_जई_अगसत_सितमबर_अकबर_नवमबर_दिसमबर'.split(
'_'
),
standalone:
'जनवर_फरवर_मच_अपल_मई_जन_जई_अगसत_सिबर_अकबर_नवबर_दिबर'.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 बज',
},
monthsParse: monthsParse,
longMonthsParse: monthsParse,
shortMonthsParse: shortMonthsParse,
monthsRegex:
/^(जनवर|जन\.?|फरवर|फरवर|फर\.?|मच?|अपल|अप\.?|मई?|जन?|जई|जल\.?|अगसत|अग\.?|सितमबर|सिबर|सित\.?|अकबर|अक\.?|नवमबर|नवबर|नव\.?|दिसमबर|दिबर|दिस\.?)/i,
monthsShortRegex:
/^(जनवर|जन\.?|फरवर|फरवर|फर\.?|मच?|अपल|अप\.?|मई?|जन?|जई|जल\.?|अगसत|अग\.?|सितमबर|सिबर|सित\.?|अकबर|अक\.?|नवमबर|नवबर|नव\.?|दिसमबर|दिबर|दिस\.?)/i,
monthsStrictRegex:
/^(जनवर?|फरवर|फरवर?|मच?|अपल?|मई?|जन?|जई?|अगसत?|सितमबर|सिबर|सित?\.?|अकबर|अक\.?|नवमबर|नवबर?|दिसमबर|दिबर?)/i,
monthsShortStrictRegex:
/^(जन\.?|फर\.?|मच?|अप\.?|मई?|जन?|जल\.?|अग\.?|सित\.?|अक\.?|नव\.?|दिस\.?)/i,
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];
});
},
// Hindi 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 Hindi.
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.
},
});