UNPKG

3.73 kBJavaScriptView Raw
1//! moment.js locale configuration
2//! locale : Chinese (Taiwan) [zh-tw]
3//! author : Ben : https://github.com/ben-lin
4//! author : Chris Lam : https://github.com/hehachris
5
6;(function (global, factory) {
7 typeof exports === 'object' && typeof module !== 'undefined'
8 && typeof require === 'function' ? factory(require('../moment')) :
9 typeof define === 'function' && define.amd ? define(['../moment'], factory) :
10 factory(global.moment)
11}(this, (function (moment) { 'use strict';
12
13 //! moment.js locale configuration
14
15 var zhTw = moment.defineLocale('zh-tw', {
16 months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
17 '_'
18 ),
19 monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
20 '_'
21 ),
22 weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
23 weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'),
24 weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
25 longDateFormat: {
26 LT: 'HH:mm',
27 LTS: 'HH:mm:ss',
28 L: 'YYYY/MM/DD',
29 LL: 'YYYY年M月D日',
30 LLL: 'YYYY年M月D日 HH:mm',
31 LLLL: 'YYYY年M月D日dddd HH:mm',
32 l: 'YYYY/M/D',
33 ll: 'YYYY年M月D日',
34 lll: 'YYYY年M月D日 HH:mm',
35 llll: 'YYYY年M月D日dddd HH:mm',
36 },
37 meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
38 meridiemHour: function (hour, meridiem) {
39 if (hour === 12) {
40 hour = 0;
41 }
42 if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
43 return hour;
44 } else if (meridiem === '中午') {
45 return hour >= 11 ? hour : hour + 12;
46 } else if (meridiem === '下午' || meridiem === '晚上') {
47 return hour + 12;
48 }
49 },
50 meridiem: function (hour, minute, isLower) {
51 var hm = hour * 100 + minute;
52 if (hm < 600) {
53 return '凌晨';
54 } else if (hm < 900) {
55 return '早上';
56 } else if (hm < 1130) {
57 return '上午';
58 } else if (hm < 1230) {
59 return '中午';
60 } else if (hm < 1800) {
61 return '下午';
62 } else {
63 return '晚上';
64 }
65 },
66 calendar: {
67 sameDay: '[今天] LT',
68 nextDay: '[明天] LT',
69 nextWeek: '[下]dddd LT',
70 lastDay: '[昨天] LT',
71 lastWeek: '[上]dddd LT',
72 sameElse: 'L',
73 },
74 dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
75 ordinal: function (number, period) {
76 switch (period) {
77 case 'd':
78 case 'D':
79 case 'DDD':
80 return number + '日';
81 case 'M':
82 return number + '月';
83 case 'w':
84 case 'W':
85 return number + '週';
86 default:
87 return number;
88 }
89 },
90 relativeTime: {
91 future: '%s後',
92 past: '%s前',
93 s: '幾秒',
94 ss: '%d 秒',
95 m: '1 分鐘',
96 mm: '%d 分鐘',
97 h: '1 小時',
98 hh: '%d 小時',
99 d: '1 天',
100 dd: '%d 天',
101 M: '1 個月',
102 MM: '%d 個月',
103 y: '1 年',
104 yy: '%d 年',
105 },
106 });
107
108 return zhTw;
109
110})));