UNPKG

4.99 kBJavaScriptView Raw
1//! moment.js locale configuration
2//! locale : Punjabi (India) [pa-in]
3//! author : Harpreet Singh : https://github.com/harpreetkhalsagtbit
4
5;(function (global, factory) {
6 typeof exports === 'object' && typeof module !== 'undefined'
7 && typeof require === 'function' ? factory(require('../moment')) :
8 typeof define === 'function' && define.amd ? define(['../moment'], factory) :
9 factory(global.moment)
10}(this, (function (moment) { 'use strict';
11
12 //! moment.js locale configuration
13
14 var symbolMap = {
15 1: '੧',
16 2: '੨',
17 3: '੩',
18 4: '੪',
19 5: '੫',
20 6: '੬',
21 7: '੭',
22 8: '੮',
23 9: '੯',
24 0: '੦',
25 },
26 numberMap = {
27 '੧': '1',
28 '੨': '2',
29 '੩': '3',
30 '੪': '4',
31 '੫': '5',
32 '੬': '6',
33 '੭': '7',
34 '੮': '8',
35 '੯': '9',
36 '੦': '0',
37 };
38
39 var paIn = moment.defineLocale('pa-in', {
40 // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi.
41 months: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
42 '_'
43 ),
44 monthsShort: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
45 '_'
46 ),
47 weekdays: 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split(
48 '_'
49 ),
50 weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
51 weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
52 longDateFormat: {
53 LT: 'A h:mm ਵਜੇ',
54 LTS: 'A h:mm:ss ਵਜੇ',
55 L: 'DD/MM/YYYY',
56 LL: 'D MMMM YYYY',
57 LLL: 'D MMMM YYYY, A h:mm ਵਜੇ',
58 LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ',
59 },
60 calendar: {
61 sameDay: '[ਅਜ] LT',
62 nextDay: '[ਕਲ] LT',
63 nextWeek: '[ਅਗਲਾ] dddd, LT',
64 lastDay: '[ਕਲ] LT',
65 lastWeek: '[ਪਿਛਲੇ] dddd, LT',
66 sameElse: 'L',
67 },
68 relativeTime: {
69 future: '%s ਵਿੱਚ',
70 past: '%s ਪਿਛਲੇ',
71 s: 'ਕੁਝ ਸਕਿੰਟ',
72 ss: '%d ਸਕਿੰਟ',
73 m: 'ਇਕ ਮਿੰਟ',
74 mm: '%d ਮਿੰਟ',
75 h: 'ਇੱਕ ਘੰਟਾ',
76 hh: '%d ਘੰਟੇ',
77 d: 'ਇੱਕ ਦਿਨ',
78 dd: '%d ਦਿਨ',
79 M: 'ਇੱਕ ਮਹੀਨਾ',
80 MM: '%d ਮਹੀਨੇ',
81 y: 'ਇੱਕ ਸਾਲ',
82 yy: '%d ਸਾਲ',
83 },
84 preparse: function (string) {
85 return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) {
86 return numberMap[match];
87 });
88 },
89 postformat: function (string) {
90 return string.replace(/\d/g, function (match) {
91 return symbolMap[match];
92 });
93 },
94 // Punjabi notation for meridiems are quite fuzzy in practice. While there exists
95 // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi.
96 meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,
97 meridiemHour: function (hour, meridiem) {
98 if (hour === 12) {
99 hour = 0;
100 }
101 if (meridiem === 'ਰਾਤ') {
102 return hour < 4 ? hour : hour + 12;
103 } else if (meridiem === 'ਸਵੇਰ') {
104 return hour;
105 } else if (meridiem === 'ਦੁਪਹਿਰ') {
106 return hour >= 10 ? hour : hour + 12;
107 } else if (meridiem === 'ਸ਼ਾਮ') {
108 return hour + 12;
109 }
110 },
111 meridiem: function (hour, minute, isLower) {
112 if (hour < 4) {
113 return 'ਰਾਤ';
114 } else if (hour < 10) {
115 return 'ਸਵੇਰ';
116 } else if (hour < 17) {
117 return 'ਦੁਪਹਿਰ';
118 } else if (hour < 20) {
119 return 'ਸ਼ਾਮ';
120 } else {
121 return 'ਰਾਤ';
122 }
123 },
124 week: {
125 dow: 0, // Sunday is the first day of the week.
126 doy: 6, // The week that contains Jan 6th is the first week of the year.
127 },
128 });
129
130 return paIn;
131
132})));