ja.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. //! moment.js locale configuration
  2. //! locale : Japanese [ja]
  3. //! author : LI Long : https://github.com/baryon
  4. import moment from '../moment';
  5. export default moment.defineLocale('ja', {
  6. eras: [
  7. {
  8. since: '2019-05-01',
  9. offset: 1,
  10. name: '令和',
  11. narrow: '㋿',
  12. abbr: 'R',
  13. },
  14. {
  15. since: '1989-01-08',
  16. until: '2019-04-30',
  17. offset: 1,
  18. name: '平成',
  19. narrow: '㍻',
  20. abbr: 'H',
  21. },
  22. {
  23. since: '1926-12-25',
  24. until: '1989-01-07',
  25. offset: 1,
  26. name: '昭和',
  27. narrow: '㍼',
  28. abbr: 'S',
  29. },
  30. {
  31. since: '1912-07-30',
  32. until: '1926-12-24',
  33. offset: 1,
  34. name: '大正',
  35. narrow: '㍽',
  36. abbr: 'T',
  37. },
  38. {
  39. since: '1873-01-01',
  40. until: '1912-07-29',
  41. offset: 6,
  42. name: '明治',
  43. narrow: '㍾',
  44. abbr: 'M',
  45. },
  46. {
  47. since: '0001-01-01',
  48. until: '1873-12-31',
  49. offset: 1,
  50. name: '西暦',
  51. narrow: 'AD',
  52. abbr: 'AD',
  53. },
  54. {
  55. since: '0000-12-31',
  56. until: -Infinity,
  57. offset: 1,
  58. name: '紀元前',
  59. narrow: 'BC',
  60. abbr: 'BC',
  61. },
  62. ],
  63. eraYearOrdinalRegex: /(元|\d+)年/,
  64. eraYearOrdinalParse: function (input, match) {
  65. return match[1] === '元' ? 1 : parseInt(match[1] || input, 10);
  66. },
  67. months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
  68. monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
  69. '_'
  70. ),
  71. weekdays: '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'),
  72. weekdaysShort: '日_月_火_水_木_金_土'.split('_'),
  73. weekdaysMin: '日_月_火_水_木_金_土'.split('_'),
  74. longDateFormat: {
  75. LT: 'HH:mm',
  76. LTS: 'HH:mm:ss',
  77. L: 'YYYY/MM/DD',
  78. LL: 'YYYY年M月D日',
  79. LLL: 'YYYY年M月D日 HH:mm',
  80. LLLL: 'YYYY年M月D日 dddd HH:mm',
  81. l: 'YYYY/MM/DD',
  82. ll: 'YYYY年M月D日',
  83. lll: 'YYYY年M月D日 HH:mm',
  84. llll: 'YYYY年M月D日(ddd) HH:mm',
  85. },
  86. meridiemParse: /午前|午後/i,
  87. isPM: function (input) {
  88. return input === '午後';
  89. },
  90. meridiem: function (hour, minute, isLower) {
  91. if (hour < 12) {
  92. return '午前';
  93. } else {
  94. return '午後';
  95. }
  96. },
  97. calendar: {
  98. sameDay: '[今日] LT',
  99. nextDay: '[明日] LT',
  100. nextWeek: function (now) {
  101. if (now.week() !== this.week()) {
  102. return '[来週]dddd LT';
  103. } else {
  104. return 'dddd LT';
  105. }
  106. },
  107. lastDay: '[昨日] LT',
  108. lastWeek: function (now) {
  109. if (this.week() !== now.week()) {
  110. return '[先週]dddd LT';
  111. } else {
  112. return 'dddd LT';
  113. }
  114. },
  115. sameElse: 'L',
  116. },
  117. dayOfMonthOrdinalParse: /\d{1,2}日/,
  118. ordinal: function (number, period) {
  119. switch (period) {
  120. case 'y':
  121. return number === 1 ? '元年' : number + '年';
  122. case 'd':
  123. case 'D':
  124. case 'DDD':
  125. return number + '日';
  126. default:
  127. return number;
  128. }
  129. },
  130. relativeTime: {
  131. future: '%s後',
  132. past: '%s前',
  133. s: '数秒',
  134. ss: '%d秒',
  135. m: '1分',
  136. mm: '%d分',
  137. h: '1時間',
  138. hh: '%d時間',
  139. d: '1日',
  140. dd: '%d日',
  141. M: '1ヶ月',
  142. MM: '%dヶ月',
  143. y: '1年',
  144. yy: '%d年',
  145. },
  146. });