fix: correct isToday check in DateTimePicker

getMonth() returns 0-11, but the comparison string was not adjusting
for this, so the "today" highlight in the calendar never matched.

https://claude.ai/code/session_013ooJht2HrZUTXgNJFU79cV
This commit is contained in:
Claude 2026-04-16 07:20:50 +00:00
parent ec6f35ad02
commit 24a62b6685
No known key found for this signature in database

View file

@ -18,7 +18,7 @@
let selectedMinute = $state(existing ? existing.getMinutes() : 0);
let visible = $state(false);
let todayStr = `${now.getFullYear()}-${now.getMonth()}-${now.getDate()}`;
let todayStr = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
let daysInMonth = $derived(new Date(viewYear, viewMonth + 1, 0).getDate());
let firstDayOfWeek = $derived(new Date(viewYear, viewMonth, 1).getDay());
@ -53,7 +53,7 @@
}
function isToday(day: number): boolean {
return `${viewYear}-${viewMonth}-${day}` === todayStr;
return `${viewYear}-${viewMonth + 1}-${day}` === todayStr;
}
function isSelected(day: number): boolean {