index.ts 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // @ts-nocheck
  2. import type { DayutsLocale, DayutsRelativeTime, DayutsFormats } from '../../../utssdk/interface'
  3. const locale : DayutsLocale = {
  4. name: 'zh-cn',
  5. weekdays: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
  6. weekdaysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
  7. weekdaysMin: ['日', '一', '二', '三', '四', '五', '六'],
  8. months: [
  9. '一月', '二月', '三月', '四月', '五月', '六月',
  10. '七月', '八月', '九月', '十月', '十一月', '十二月'
  11. ],
  12. monthsShort: [
  13. '1月', '2月', '3月', '4月', '5月', '6月',
  14. '7月', '8月', '9月', '10月', '11月', '12月'
  15. ],
  16. ordinal: (number:number, period:string):string => {
  17. // switch (period) {
  18. // case 'W':
  19. // return `${number}周`;
  20. // default:
  21. // return `${number}日`;
  22. // }
  23. if(period == 'W'){
  24. return `${number}周`;
  25. }
  26. return `${number}日`
  27. },
  28. weekStart: 1,
  29. yearStart: 4,
  30. formats: {
  31. LT: 'HH:mm',
  32. LTS: 'HH:mm:ss',
  33. L: 'YYYY/MM/DD',
  34. LL: 'YYYY年M月D日',
  35. LLL: 'YYYY年M月D日Ah点mm分',
  36. LLLL: 'YYYY年M月D日ddddAh点mm分',
  37. l: 'YYYY/M/D',
  38. ll: 'YYYY年M月D日',
  39. lll: 'YYYY年M月D日 HH:mm',
  40. llll: 'YYYY年M月D日dddd HH:mm'
  41. } as DayutsFormats,
  42. relativeTime: {
  43. future: '%s内',
  44. past: '%s前',
  45. s: '几秒',
  46. m: '1 分钟',
  47. mm: '%d 分钟',
  48. h: '1 小时',
  49. hh: '%d 小时',
  50. d: '1 天',
  51. dd: '%d 天',
  52. M: '1 个月',
  53. MM: '%d 个月',
  54. y: '1 年',
  55. yy: '%d 年'
  56. } as DayutsRelativeTime,
  57. meridiem: (hour:number, minute:number, _ : boolean):string => {
  58. const hm = (hour * 100) + minute;
  59. if (hm < 600) {
  60. return '凌晨';
  61. } else if (hm < 900) {
  62. return '早上';
  63. } else if (hm < 1100) {
  64. return '上午';
  65. } else if (hm < 1300) {
  66. return '中午';
  67. } else if (hm < 1800) {
  68. return '下午';
  69. }
  70. return '晚上';
  71. }
  72. };
  73. export default locale;