75 lines
1.8 KiB
TypeScript
75 lines
1.8 KiB
TypeScript
![]() |
const shortcuts = [
|
||
|
{
|
||
|
text: '今天',
|
||
|
value: () => {
|
||
|
const end = new Date()
|
||
|
const start = new Date()
|
||
|
return [start, end]
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text: '昨天',
|
||
|
value: () => {
|
||
|
const end = new Date()
|
||
|
const start = new Date()
|
||
|
start.setDate(start.getDate() - 1)
|
||
|
end.setDate(end.getDate() - 1)
|
||
|
return [start, end]
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text: '最近7天',
|
||
|
value: () => {
|
||
|
const end = new Date()
|
||
|
const start = new Date()
|
||
|
start.setDate(start.getDate() - 7)
|
||
|
return [start, end]
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text: '最近30天',
|
||
|
value: () => {
|
||
|
const end = new Date()
|
||
|
const start = new Date()
|
||
|
start.setDate(start.getDate() - 30)
|
||
|
return [start, end]
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text: '上月',
|
||
|
value: () => {
|
||
|
const end = new Date()
|
||
|
const start = new Date()
|
||
|
start.setMonth(start.getMonth() - 1)
|
||
|
start.setDate(1);
|
||
|
end.setDate(0);
|
||
|
return [start, end]
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text: '本月',
|
||
|
value: () => {
|
||
|
const end = new Date()
|
||
|
const start = new Date()
|
||
|
start.setDate(1);
|
||
|
end.setMonth(end.getMonth() + 1)
|
||
|
end.setDate(0);
|
||
|
return [start, end]
|
||
|
},
|
||
|
},
|
||
|
{
|
||
|
text: '本年',
|
||
|
value: () => {
|
||
|
const end = new Date()
|
||
|
const start = new Date()
|
||
|
start.setMonth(0);
|
||
|
start.setDate(1);
|
||
|
end.setFullYear(end.getFullYear() + 1);
|
||
|
end.setMonth(0);
|
||
|
end.setDate(0);
|
||
|
return [start, end]
|
||
|
},
|
||
|
},
|
||
|
]
|
||
|
|
||
|
export default shortcuts
|