You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
4.7 KiB

  1. //! moment.js locale configuration
  2. //! locale : chinese (zh-cn)
  3. //! author : suupic : https://github.com/suupic
  4. //! author : Zeno Zeng : https://github.com/zenozeng
  5. (function (global, factory) {
  6. typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) :
  7. typeof define === 'function' && define.amd ? define(['moment'], factory) :
  8. factory(global.moment)
  9. }(this, function (moment) { 'use strict';
  10. var zh_cn = moment.defineLocale('zh-cn', {
  11. months : '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
  12. monthsShort : '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  13. weekdays : '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
  14. weekdaysShort : '周日_周一_周二_周三_周四_周五_周六'.split('_'),
  15. weekdaysMin : '日_一_二_三_四_五_六'.split('_'),
  16. longDateFormat : {
  17. LT : 'Ah点mm',
  18. LTS : 'Ah点m分s秒',
  19. L : 'YYYY-MM-DD',
  20. LL : 'YYYY年MMMD日',
  21. LLL : 'YYYY年MMMD日LT',
  22. LLLL : 'YYYY年MMMD日ddddLT',
  23. l : 'YYYY-MM-DD',
  24. ll : 'YYYY年MMMD日',
  25. lll : 'YYYY年MMMD日LT',
  26. llll : 'YYYY年MMMD日ddddLT'
  27. },
  28. meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
  29. meridiemHour: function (hour, meridiem) {
  30. if (hour === 12) {
  31. hour = 0;
  32. }
  33. if (meridiem === '凌晨' || meridiem === '早上' ||
  34. 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 : function () {
  61. return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
  62. },
  63. nextDay : function () {
  64. return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
  65. },
  66. lastDay : function () {
  67. return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
  68. },
  69. nextWeek : function () {
  70. var startOfWeek, prefix;
  71. startOfWeek = moment().startOf('week');
  72. prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
  73. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  74. },
  75. lastWeek : function () {
  76. var startOfWeek, prefix;
  77. startOfWeek = moment().startOf('week');
  78. prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
  79. return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
  80. },
  81. sameElse : 'LL'
  82. },
  83. ordinalParse: /\d{1,2}(日|月|周)/,
  84. ordinal : function (number, period) {
  85. switch (period) {
  86. case 'd':
  87. case 'D':
  88. case 'DDD':
  89. return number + '日';
  90. case 'M':
  91. return number + '月';
  92. case 'w':
  93. case 'W':
  94. return number + '周';
  95. default:
  96. return number;
  97. }
  98. },
  99. relativeTime : {
  100. future : '%s内',
  101. past : '%s前',
  102. s : '几秒',
  103. m : '1分钟',
  104. mm : '%d分钟',
  105. h : '1小时',
  106. hh : '%d小时',
  107. d : '1天',
  108. dd : '%d天',
  109. M : '1个月',
  110. MM : '%d个月',
  111. y : '1年',
  112. yy : '%d年'
  113. },
  114. week : {
  115. // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
  116. dow : 1, // Monday is the first day of the week.
  117. doy : 4 // The week that contains Jan 4th is the first week of the year.
  118. }
  119. });
  120. return zh_cn;
  121. }));