|
|
|
import React from "react";
|
|
|
|
import dayjs from "dayjs";
|
|
|
|
|
|
|
|
export const DATE_FORMAT = "YYYY-MM-DD";
|
|
|
|
export const DATE_PRESETS = [
|
|
|
|
{
|
|
|
|
label: "本周",
|
|
|
|
value: [dayjs().startOf("w"), dayjs().endOf("w")],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "上周",
|
|
|
|
value: [dayjs().startOf("w").subtract(7, "days"), dayjs().endOf("w").subtract(7, "days")],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "本月",
|
|
|
|
value: [dayjs().startOf("M"), dayjs().endOf("M")],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "上个月",
|
|
|
|
value: [dayjs().subtract(1, "M").startOf("M"), dayjs().subtract(1, "M").endOf("M")],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "近三月",
|
|
|
|
value: [dayjs().subtract(2, "M").startOf("M"), dayjs().endOf("M")],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: "今年",
|
|
|
|
value: [dayjs().startOf("y"), dayjs().endOf("y")],
|
|
|
|
},
|
|
|
|
// 本月: [dayjs().startOf("month"), moment().endOf("month")],
|
|
|
|
// 上个月: [dayjs().subtract(1, "months").startOf("month"), moment(new Date()).subtract(1, "months").endOf("month")],
|
|
|
|
// 近7天: [dayjs().add(-7, "days"), dayjs()],
|
|
|
|
// 近30天: [dayjs().subtract(30, "days"), moment()],
|
|
|
|
// 近三个月: [dayjs().subtract(2, "month").startOf("month"), moment().endOf("month")],
|
|
|
|
// 今年: [dayjs().startOf("year"), moment().endOf("year")],
|
|
|
|
// 去年: [dayjs().subtract(1, "year").startOf("year"), moment().subtract(1, "year").endOf("year")],
|
|
|
|
];
|
|
|
|
export const HT_HOST = process.env.NODE_ENV == "production" ? "https://p9axztuwd7x8a7.mycht.cn" : "http://202.103.68.100:890";
|