zh-cn.js 4.4 KB

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