more filter for sales order
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user