UNPKG

5.21 kBJavaScriptView Raw
1//! moment.js locale configuration
2//! locale : Tibetan [bo]
3//! author : Thupten N. Chakrishar : https://github.com/vajradog
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 bo = moment.defineLocale('bo', {
40 months: 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split(
41 '_'
42 ),
43 monthsShort:
44 'ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12'.split(
45 '_'
46 ),
47 monthsShortRegex: /^(ཟླ་\d{1,2})/,
48 monthsParseExact: true,
49 weekdays:
50 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split(
51 '_'
52 ),
53 weekdaysShort: 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split(
54 '_'
55 ),
56 weekdaysMin: 'ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན'.split('_'),
57 longDateFormat: {
58 LT: 'A h:mm',
59 LTS: 'A h:mm:ss',
60 L: 'DD/MM/YYYY',
61 LL: 'D MMMM YYYY',
62 LLL: 'D MMMM YYYY, A h:mm',
63 LLLL: 'dddd, D MMMM YYYY, A h:mm',
64 },
65 calendar: {
66 sameDay: '[དི་རིང] LT',
67 nextDay: '[སང་ཉིན] LT',
68 nextWeek: '[བདུན་ཕྲག་རྗེས་མ], LT',
69 lastDay: '[ཁ་སང] LT',
70 lastWeek: '[བདུན་ཕྲག་མཐའ་མ] dddd, LT',
71 sameElse: 'L',
72 },
73 relativeTime: {
74 future: '%s ལ་',
75 past: '%s སྔན་ལ',
76 s: 'ལམ་སང',
77 ss: '%d སྐར་ཆ།',
78 m: 'སྐར་མ་གཅིག',
79 mm: '%d སྐར་མ',
80 h: 'ཆུ་ཚོད་གཅིག',
81 hh: '%d ཆུ་ཚོད',
82 d: 'ཉིན་གཅིག',
83 dd: '%d ཉིན་',
84 M: 'ཟླ་བ་གཅིག',
85 MM: '%d ཟླ་བ',
86 y: 'ལོ་གཅིག',
87 yy: '%d ལོ',
88 },
89 preparse: function (string) {
90 return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) {
91 return numberMap[match];
92 });
93 },
94 postformat: function (string) {
95 return string.replace(/\d/g, function (match) {
96 return symbolMap[match];
97 });
98 },
99 meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
100 meridiemHour: function (hour, meridiem) {
101 if (hour === 12) {
102 hour = 0;
103 }
104 if (
105 (meridiem === 'མཚན་མོ' && hour >= 4) ||
106 (meridiem === 'ཉིན་གུང' && hour < 5) ||
107 meridiem === 'དགོང་དག'
108 ) {
109 return hour + 12;
110 } else {
111 return hour;
112 }
113 },
114 meridiem: function (hour, minute, isLower) {
115 if (hour < 4) {
116 return 'མཚན་མོ';
117 } else if (hour < 10) {
118 return 'ཞོགས་ཀས';
119 } else if (hour < 17) {
120 return 'ཉིན་གུང';
121 } else if (hour < 20) {
122 return 'དགོང་དག';
123 } else {
124 return 'མཚན་མོ';
125 }
126 },
127 week: {
128 dow: 0, // Sunday is the first day of the week.
129 doy: 6, // The week that contains Jan 6th is the first week of the year.
130 },
131 });
132
133 return bo;
134
135})));