more filter for sales order

This commit is contained in:
Timi
2026-09-20 15:43:19 +08:00
parent 2aa29da3ff
commit 2fbd4c9fd0
9 changed files with 1337 additions and 180 deletions
+8
View File
@@ -5,6 +5,7 @@ export type DateFilterPreset =
| "all"
| "today"
| "yesterday"
| "thisWeek"
| "lastWeek"
| "thisMonth"
| "lastMonth"
@@ -33,6 +34,13 @@ export function buildPresetDateRange(type: DateFilterPreset, now = new Date()):
return buildDayRange(lastWeekMonday, lastWeekSunday);
}
if (type === "thisWeek") {
const current = getDateStart(now);
const day = current.getDay() || 7;
const thisWeekMonday = addDays(current, 1 - day);
return buildDayRange(thisWeekMonday, current);
}
if (type === "thisMonth") {
const current = new Date(now);
const begin = new Date(current.getFullYear(), current.getMonth(), 1);