Files
fe.ems.vue3/src/hooks/useRangePicker.ts

48 lines
1.0 KiB
TypeScript

import dayjs from 'dayjs';
/**日期快捷选择 */
export function dayjsRanges() {
return [
{
label: 'Today',
value: [dayjs().startOf('day'), dayjs()],
},
{
label: 'Last 1 hour',
value: [
dayjs().subtract(1, 'hour').startOf('hour'),
dayjs().subtract(1, 'hour').endOf('hour'),
],
},
// {
// label: 'Last 3 hour',
// value: [dayjs().subtract(3, 'hours'), dayjs()],
// },
// {
// label: 'Last 6 hour',
// value: [dayjs().subtract(6, 'hours'), dayjs()],
// },
{
label: 'Last 1 day',
value: [
dayjs().subtract(1, 'day').startOf('day'),
dayjs().subtract(1, 'day').endOf('day'),
],
},
{
label: 'Last 7 day',
value: [
dayjs().subtract(7, 'day').startOf('day'),
dayjs().subtract(1, 'day').endOf('day'),
],
},
{
label: 'Last 15 day',
value: [
dayjs().subtract(15, 'day').startOf('day'),
dayjs().subtract(1, 'day').endOf('day'),
],
},
];
}