index.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. "use strict";
  2. var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
  3. Object.defineProperty(exports, "__esModule", {
  4. value: true
  5. });
  6. exports.default = void 0;
  7. var _index = _interopRequireDefault(require("../../../_lib/buildLocalizeFn/index.js"));
  8. var eraValues = {
  9. narrow: ['前', '公元'],
  10. abbreviated: ['前', '公元'],
  11. wide: ['公元前', '公元']
  12. };
  13. var quarterValues = {
  14. narrow: ['1', '2', '3', '4'],
  15. abbreviated: ['第一季', '第二季', '第三季', '第四季'],
  16. wide: ['第一季度', '第二季度', '第三季度', '第四季度']
  17. };
  18. var monthValues = {
  19. narrow: ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'],
  20. abbreviated: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
  21. wide: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月']
  22. };
  23. var dayValues = {
  24. narrow: ['日', '一', '二', '三', '四', '五', '六'],
  25. short: ['日', '一', '二', '三', '四', '五', '六'],
  26. abbreviated: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
  27. wide: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  28. };
  29. var dayPeriodValues = {
  30. narrow: {
  31. am: '上',
  32. pm: '下',
  33. midnight: '凌晨',
  34. noon: '午',
  35. morning: '早',
  36. afternoon: '下午',
  37. evening: '晚',
  38. night: '夜'
  39. },
  40. abbreviated: {
  41. am: '上午',
  42. pm: '下午',
  43. midnight: '凌晨',
  44. noon: '中午',
  45. morning: '早晨',
  46. afternoon: '中午',
  47. evening: '晚上',
  48. night: '夜间'
  49. },
  50. wide: {
  51. am: '上午',
  52. pm: '下午',
  53. midnight: '凌晨',
  54. noon: '中午',
  55. morning: '早晨',
  56. afternoon: '中午',
  57. evening: '晚上',
  58. night: '夜间'
  59. }
  60. };
  61. var formattingDayPeriodValues = {
  62. narrow: {
  63. am: '上',
  64. pm: '下',
  65. midnight: '凌晨',
  66. noon: '午',
  67. morning: '早',
  68. afternoon: '下午',
  69. evening: '晚',
  70. night: '夜'
  71. },
  72. abbreviated: {
  73. am: '上午',
  74. pm: '下午',
  75. midnight: '凌晨',
  76. noon: '中午',
  77. morning: '早晨',
  78. afternoon: '中午',
  79. evening: '晚上',
  80. night: '夜间'
  81. },
  82. wide: {
  83. am: '上午',
  84. pm: '下午',
  85. midnight: '凌晨',
  86. noon: '中午',
  87. morning: '早晨',
  88. afternoon: '中午',
  89. evening: '晚上',
  90. night: '夜间'
  91. }
  92. };
  93. var ordinalNumber = function ordinalNumber(dirtyNumber, options) {
  94. var number = Number(dirtyNumber);
  95. switch (options === null || options === void 0 ? void 0 : options.unit) {
  96. case 'date':
  97. return number.toString() + '日';
  98. case 'hour':
  99. return number.toString() + '时';
  100. case 'minute':
  101. return number.toString() + '分';
  102. case 'second':
  103. return number.toString() + '秒';
  104. default:
  105. return '第 ' + number.toString();
  106. }
  107. };
  108. var localize = {
  109. ordinalNumber: ordinalNumber,
  110. era: (0, _index.default)({
  111. values: eraValues,
  112. defaultWidth: 'wide'
  113. }),
  114. quarter: (0, _index.default)({
  115. values: quarterValues,
  116. defaultWidth: 'wide',
  117. argumentCallback: function argumentCallback(quarter) {
  118. return quarter - 1;
  119. }
  120. }),
  121. month: (0, _index.default)({
  122. values: monthValues,
  123. defaultWidth: 'wide'
  124. }),
  125. day: (0, _index.default)({
  126. values: dayValues,
  127. defaultWidth: 'wide'
  128. }),
  129. dayPeriod: (0, _index.default)({
  130. values: dayPeriodValues,
  131. defaultWidth: 'wide',
  132. formattingValues: formattingDayPeriodValues,
  133. defaultFormattingWidth: 'wide'
  134. })
  135. };
  136. var _default = localize;
  137. exports.default = _default;
  138. module.exports = exports.default;