Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/components/DateTimePicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,21 @@
onMonthChange?.(formatDate(start), formatDate(end));
};

const clearDateTimeSelection = () => {
selectedDate = undefined;
selectedTime = undefined;
};
Comment on lines +98 to +101
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 No test coverage for the new clearing behavior

The test file (src/tests/components/date-time-picker.test.ts) tests pure calendar/date helpers but has no test verifying that month navigation clears the selection. A future refactor could silently drop the clearDateTimeSelection() call from prevMonth/nextMonth without any test failing. Consider adding a test that exercises the navigation functions and asserts selectedDate and selectedTime become undefined.


// Navigate months
const prevMonth = () => {
currentMonth = new Date(currentMonth.getFullYear(), currentMonth.getMonth() - 1, 1);
clearDateTimeSelection();
emitMonthRange(currentMonth);
};

const nextMonth = () => {
currentMonth = new Date(currentMonth.getFullYear(), currentMonth.getMonth() + 1, 1);
clearDateTimeSelection();
emitMonthRange(currentMonth);
};

Expand Down
Loading