zh-tw.js 3.6 KB

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