zh-cn.js 3.6 KB

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