Skip to content

Commit 062de79

Browse files
committed
✨ feat(dates): use supplied end param in computeSomedayEventsRequestFilter
1 parent 562dcbf commit 062de79

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/web/src/common/utils/datetime/web.date.util.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,13 @@ export const computeRelativeEventDateRange = (
336336
};
337337
};
338338

339-
export const computeSomedayEventsRequestFilter = (start: Dayjs) => {
339+
export const computeSomedayEventsRequestFilter = (
340+
start: Dayjs,
341+
end?: Dayjs,
342+
) => {
340343
const startDate = start.subtract(1, "month").endOf("month");
341-
const endDate = start.endOf("month").add(1, "week");
344+
const validEnd = end?.isAfter(start) ?? false;
345+
const endDate = validEnd ? end! : start.endOf("month").add(1, "week");
342346

343347
return {
344348
startDate: toUTCOffset(startDate),

packages/web/src/views/Calendar/hooks/useRefresh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export const useRefresh = () => {
4343
case Sync_AsyncStateContextReason.SOCKET_SOMEDAY_EVENT_CHANGED: {
4444
const { startDate, endDate } = computeSomedayEventsRequestFilter(
4545
dayjs(start),
46+
dayjs(end),
4647
);
4748

4849
dispatch(

0 commit comments

Comments
 (0)