add dateFilter.ts

This commit is contained in:
Timi
2026-10-22 15:16:53 +08:00
parent bba4a2d4d6
commit d31441481e
14 changed files with 48 additions and 132 deletions
+5 -11
View File
@@ -1,16 +1,10 @@
import { Time } from "timi-web";
/** 日期筛选器支持的预设范围。 */
export type DateFilterPreset =
| "all"
| "today"
| "yesterday"
| "thisWeek"
| "lastWeek"
| "thisMonth"
| "lastMonth"
| "last7"
| "last30";
/** 常规列表日期筛选类型。 */
export type DateFilterType = "today" | "yesterday" | "thisWeek" | "thisMonth" | "lastMonth" | "all" | "custom";
/** 日期范围计算支持的预设类型。 */
export type DateFilterPreset = Exclude<DateFilterType, "custom"> | "lastWeek" | "last7" | "last30";
/** 日期时间范围,文本格式为 YYYY-MM-DD HH:mm。 */
export type DateTimeRange = [string, string];
+21
View File
@@ -0,0 +1,21 @@
import type { DateFilterType } from "@/utils/date";
export type { DateFilterType } from "@/utils/date";
/** 日期筛选选项。 */
export type DateFilterOption<T extends string> = {
label: string;
value: T;
};
/** 常规列表日期筛选选项。 */
export const DATE_FILTER_OPTIONS: DateFilterOption<DateFilterType>[] = [
{ label: "今天", value: "today" },
{ label: "昨天", value: "yesterday" },
{ label: "本周", value: "thisWeek" },
{ label: "本月", value: "thisMonth" },
{ label: "上个月", value: "lastMonth" },
{ label: "全部", value: "all" },
{ label: "自定义", value: "custom" }
];