75 lines
1.9 KiB
TypeScript
75 lines
1.9 KiB
TypeScript
// @ts-nocheck
|
|
import type { DayutsLocale, DayutsRelativeTime, DayutsFormats } from '../../../utssdk/interface'
|
|
|
|
const locale : DayutsLocale = {
|
|
name: 'zh-cn',
|
|
weekdays: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
|
|
weekdaysShort: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
|
|
weekdaysMin: ['日', '一', '二', '三', '四', '五', '六'],
|
|
months: [
|
|
'一月', '二月', '三月', '四月', '五月', '六月',
|
|
'七月', '八月', '九月', '十月', '十一月', '十二月'
|
|
],
|
|
monthsShort: [
|
|
'1月', '2月', '3月', '4月', '5月', '6月',
|
|
'7月', '8月', '9月', '10月', '11月', '12月'
|
|
],
|
|
ordinal: (number:number, period:string):string => {
|
|
// switch (period) {
|
|
// case 'W':
|
|
// return `${number}周`;
|
|
// default:
|
|
// return `${number}日`;
|
|
// }
|
|
if(period == 'W'){
|
|
return `${number}周`;
|
|
}
|
|
return `${number}日`
|
|
},
|
|
weekStart: 1,
|
|
yearStart: 4,
|
|
formats: {
|
|
LT: 'HH:mm',
|
|
LTS: 'HH:mm:ss',
|
|
L: 'YYYY/MM/DD',
|
|
LL: 'YYYY年M月D日',
|
|
LLL: 'YYYY年M月D日Ah点mm分',
|
|
LLLL: 'YYYY年M月D日ddddAh点mm分',
|
|
l: 'YYYY/M/D',
|
|
ll: 'YYYY年M月D日',
|
|
lll: 'YYYY年M月D日 HH:mm',
|
|
llll: 'YYYY年M月D日dddd HH:mm'
|
|
} as DayutsFormats,
|
|
relativeTime: {
|
|
future: '%s内',
|
|
past: '%s前',
|
|
s: '几秒',
|
|
m: '1 分钟',
|
|
mm: '%d 分钟',
|
|
h: '1 小时',
|
|
hh: '%d 小时',
|
|
d: '1 天',
|
|
dd: '%d 天',
|
|
M: '1 个月',
|
|
MM: '%d 个月',
|
|
y: '1 年',
|
|
yy: '%d 年'
|
|
} as DayutsRelativeTime,
|
|
meridiem: (hour:number, minute:number, _ : boolean):string => {
|
|
const hm = (hour * 100) + minute;
|
|
if (hm < 600) {
|
|
return '凌晨';
|
|
} else if (hm < 900) {
|
|
return '早上';
|
|
} else if (hm < 1100) {
|
|
return '上午';
|
|
} else if (hm < 1300) {
|
|
return '中午';
|
|
} else if (hm < 1800) {
|
|
return '下午';
|
|
}
|
|
return '晚上';
|
|
}
|
|
};
|
|
|
|
export default locale; |