default-time-ranges.js 1.0 KB

1234567891011121314151617181920212223242526272829
  1. /*
  2. * 时间选择框快捷选择
  3. *
  4. * @Author: 1024创新实验室-主任:卓大
  5. * @Date: 2022-09-06 20:49:28
  6. * @Wechat: zhuda1024
  7. * @Email: lab1024@163.com
  8. * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012
  9. */
  10. import dayjs from 'dayjs';
  11. import {ref} from 'vue';
  12. export const defaultTimeRanges = ref([{label: '今日', value: [dayjs(), dayjs()]}, {
  13. label: '昨日',
  14. value: [dayjs().subtract(1, 'days'), dayjs().subtract(1, 'days')]
  15. }, {label: '本月', value: [dayjs().startOf('month'), dayjs().endOf('month')]}, {
  16. label: '上个月',
  17. value: [dayjs().subtract(1, 'months').startOf('month'), dayjs().subtract(1, 'months').endOf('month')]
  18. }, {
  19. label: '下个月',
  20. value: [dayjs().subtract(-1, 'months').startOf('month'), dayjs().subtract(-1, 'months').endOf('month')]
  21. },
  22. {label: '本年度', value: [dayjs().startOf('year'), dayjs().endOf('year')]}, {
  23. label: '上年度',
  24. value: [dayjs().subtract(1, 'years').startOf('year'), dayjs().subtract(1, 'years').endOf('year')]
  25. }]);