UNPKG

3.71 kBJavaScriptView Raw
1//! moment.js locale configuration
2//! locale : Chinese (China) [zh-cn]
3//! author : suupic : https://github.com/suupic
4//! author : Zeno Zeng : https://github.com/zenozeng
5//! author : uu109 : https://github.com/uu109
6
7import moment from '../moment';
8
9export default moment.defineLocale('zh-cn', {
10 months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
11 '_'
12 ),
13 monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
14 '_'
15 ),
16 weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
17 weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
18 weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
19 longDateFormat: {
20 LT: 'HH:mm',
21 LTS: 'HH:mm:ss',
22 L: 'YYYY/MM/DD',
23 LL: 'YYYY年M月D日',
24 LLL: 'YYYY年M月D日Ah点mm分',
25 LLLL: 'YYYY年M月D日ddddAh点mm分',
26 l: 'YYYY/M/D',
27 ll: 'YYYY年M月D日',
28 lll: 'YYYY年M月D日 HH:mm',
29 llll: 'YYYY年M月D日dddd HH:mm',
30 },
31 meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
32 meridiemHour: function (hour, meridiem) {
33 if (hour === 12) {
34 hour = 0;
35 }
36 if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
37 return hour;
38 } else if (meridiem === '下午' || meridiem === '晚上') {
39 return hour + 12;
40 } else {
41 // '中午'
42 return hour >= 11 ? hour : hour + 12;
43 }
44 },
45 meridiem: function (hour, minute, isLower) {
46 var hm = hour * 100 + minute;
47 if (hm < 600) {
48 return '凌晨';
49 } else if (hm < 900) {
50 return '早上';
51 } else if (hm < 1130) {
52 return '上午';
53 } else if (hm < 1230) {
54 return '中午';
55 } else if (hm < 1800) {
56 return '下午';
57 } else {
58 return '晚上';
59 }
60 },
61 calendar: {
62 sameDay: '[今天]LT',
63 nextDay: '[明天]LT',
64 nextWeek: function (now) {
65 if (now.week() !== this.week()) {
66 return '[下]dddLT';
67 } else {
68 return '[本]dddLT';
69 }
70 },
71 lastDay: '[昨天]LT',
72 lastWeek: function (now) {
73 if (this.week() !== now.week()) {
74 return '[上]dddLT';
75 } else {
76 return '[本]dddLT';
77 }
78 },
79 sameElse: 'L',
80 },
81 dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
82 ordinal: function (number, period) {
83 switch (period) {
84 case 'd':
85 case 'D':
86 case 'DDD':
87 return number + '日';
88 case 'M':
89 return number + '月';
90 case 'w':
91 case 'W':
92 return number + '周';
93 default:
94 return number;
95 }
96 },
97 relativeTime: {
98 future: '%s后',
99 past: '%s前',
100 s: '几秒',
101 ss: '%d 秒',
102 m: '1 分钟',
103 mm: '%d 分钟',
104 h: '1 小时',
105 hh: '%d 小时',
106 d: '1 天',
107 dd: '%d 天',
108 w: '1 周',
109 ww: '%d 周',
110 M: '1 个月',
111 MM: '%d 个月',
112 y: '1 年',
113 yy: '%d 年',
114 },
115 week: {
116 // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
117 dow: 1, // Monday is the first day of the week.
118 doy: 4, // The week that contains Jan 4th is the first week of the year.
119 },
120});