|
|
@@ -5,6 +5,8 @@ import { unref } from 'vue';
|
|
|
import { isObject } from '/@/utils/is';
|
|
|
import { cloneDeep } from 'lodash-es';
|
|
|
|
|
|
+import dayjs from 'dayjs';
|
|
|
+
|
|
|
export const noop = () => {};
|
|
|
|
|
|
/**
|
|
|
@@ -200,3 +202,22 @@ export function setParams(params: any) {
|
|
|
console.log('🚀 ~ file: index.ts:194 ~ setParams ~ params', params);
|
|
|
return params;
|
|
|
}
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: Date Range 预设范围 related enumeration
|
|
|
+ */
|
|
|
+export function dateRanges(format = 'YYYY-MM-DD') {
|
|
|
+ console.log('🚀 ~ file: index.ts:210 ~ dateRanges ~ format:', format);
|
|
|
+ return {
|
|
|
+ 今天: [dayjs(), dayjs()],
|
|
|
+ 本周: [dayjs(), dayjs().endOf('week')],
|
|
|
+ 上周: [
|
|
|
+ dayjs().add(-1, 'week').startOf('week').add(1, 'day'),
|
|
|
+ dayjs().add(-1, 'week').endOf('week').add(1, 'day'),
|
|
|
+ ],
|
|
|
+ 本月: [dayjs(), dayjs().endOf('month')],
|
|
|
+ 上月: [dayjs().add(-1, 'month').startOf('month'), dayjs().add(-1, 'month').endOf('month')],
|
|
|
+ // Today: [dayjs(), dayjs()],
|
|
|
+ // 'This Month': [dayjs(), dayjs().endOf('month')],
|
|
|
+ };
|
|
|
+}
|