feat: add rangePicker locales

This commit is contained in:
xingyu4j
2025-05-06 23:44:30 +08:00
parent bcd913dd8d
commit bd9d07dadd
5 changed files with 47 additions and 9 deletions

View File

@@ -2,33 +2,43 @@ import type { Dayjs } from 'dayjs';
import dayjs from 'dayjs';
import { $t } from '#/locales';
/** 时间段选择器拓展 */
export function getRangePickerDefaultProps() {
return {
format: 'YYYY-MM-DD HH:mm:ss',
placeholder: ['开始时间', '结束时间'],
placeholder: [
$t('utils.rangePicker.beginTime'),
$t('utils.rangePicker.endTime'),
],
ranges: {
: () =>
[$t('utils.rangePicker.today')]: () =>
[dayjs().startOf('day'), dayjs().endOf('day')] as [Dayjs, Dayjs],
'最近 7 天': () =>
[$t('utils.rangePicker.last7Days')]: () =>
[dayjs().subtract(7, 'day').startOf('day'), dayjs().endOf('day')] as [
Dayjs,
Dayjs,
],
'最近 30 天': () =>
[$t('utils.rangePicker.last30Days')]: () =>
[dayjs().subtract(30, 'day').startOf('day'), dayjs().endOf('day')] as [
Dayjs,
Dayjs,
],
: () =>
[$t('utils.rangePicker.yesterday')]: () =>
[
dayjs().subtract(1, 'day').startOf('day'),
dayjs().subtract(1, 'day').endOf('day'),
] as [Dayjs, Dayjs],
: () =>
[$t('utils.rangePicker.thisWeek')]: () =>
[dayjs().startOf('week'), dayjs().endOf('day')] as [Dayjs, Dayjs],
: () =>
[$t('utils.rangePicker.thisMonth')]: () =>
[dayjs().startOf('month'), dayjs().endOf('day')] as [Dayjs, Dayjs],
[$t('utils.rangePicker.lastWeek')]: () =>
[dayjs().subtract(1, 'week').startOf('day'), dayjs().endOf('day')] as [
Dayjs,
Dayjs,
],
},
showTime: {
defaultValue: [