shortcuts.js 896 B

12345678910111213
  1. import moment from "moment"
  2. export function rangeShortcuts(format = "YYYY-MM-DD HH:mm:ss") {
  3. return [
  4. { text: "今天", value: () => [moment().startOf("day").format(format), moment().format(format)] },
  5. { text: "本月", value: () => [moment().startOf("month").format(format), moment().format(format)] },
  6. { text: "本季度", value: () => [moment().startOf("quarter").format(format), moment().format(format)] },
  7. { text: "今年", value: () => [moment().startOf("year").format(format), moment().format(format)] },
  8. ]
  9. // { text: "近7天", value: () => [moment().subtract(1, "week").format(format), moment().format(format)] },
  10. // { text: "近1月", value: () => [moment().subtract(1, "month").format(format), moment().format(format)] },
  11. // { text: "近1年", value: () => [moment().subtract(1, "year").format(format), moment().format(format)] },
  12. }