refactor: centralize week calculation logic and standardize schedule boundary date normalization across client and server

This commit is contained in:
2026-07-28 18:12:10 -03:00
parent ece3879c8d
commit f39ba44f59
5 changed files with 113 additions and 42 deletions
+9
View File
@@ -0,0 +1,9 @@
import dayjs from "dayjs";
export const getMondayWeekStart = (date: dayjs.Dayjs = dayjs()): dayjs.Dayjs => {
return date.startOf("day").subtract((date.day() + 6) % 7, "day");
};
export const getSundayWeekEnd = (date: dayjs.Dayjs = dayjs()): dayjs.Dayjs => {
return getMondayWeekStart(date).add(6, "day");
};