41 lines
899 B
JavaScript
41 lines
899 B
JavaScript
|
|
import dayjs from "dayjs";
|
||
|
|
import quarterOfYear from "dayjs/plugin/quarterOfYear";
|
||
|
|
|
||
|
|
dayjs.extend(quarterOfYear);
|
||
|
|
|
||
|
|
export const datePresets = [
|
||
|
|
{
|
||
|
|
label: "本月",
|
||
|
|
value: [dayjs().startOf("month"), dayjs().endOf("month")],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
label: "上月",
|
||
|
|
value: [
|
||
|
|
dayjs().subtract(1, "month").startOf("month"),
|
||
|
|
dayjs().subtract(1, "month").endOf("month"),
|
||
|
|
],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
label: "本季度",
|
||
|
|
value: [dayjs().startOf("quarter"), dayjs().endOf("quarter")],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
label: "上季度",
|
||
|
|
value: [
|
||
|
|
dayjs().subtract(1, "quarter").startOf("quarter"),
|
||
|
|
dayjs().subtract(1, "quarter").endOf("quarter"),
|
||
|
|
],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
label: "本年",
|
||
|
|
value: [dayjs().startOf("year"), dayjs().endOf("year")],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
label: "去年",
|
||
|
|
value: [
|
||
|
|
dayjs().subtract(1, "year").startOf("year"),
|
||
|
|
dayjs().subtract(1, "year").endOf("year"),
|
||
|
|
],
|
||
|
|
},
|
||
|
|
];
|