fix: show overnight appointments on each covered calendar day

This commit is contained in:
2026-10-10 12:40:52 +08:00
parent e3038edd38
commit 0ca12de2f4
4 changed files with 32 additions and 5 deletions
@@ -1,5 +1,13 @@
export type CalendarMode = 'month' | 'week'
/** End times are exclusive; a slot ending at midnight does not occupy the next day. */
export function occursOnDate(startDate: string, endAt: string | undefined, date: string): boolean {
if (date === startDate) return true
if (date < startDate || !endAt) return false
const endDate = endAt.slice(0, 10)
return date < endDate || (date === endDate && /[1-9]/.test(endAt.slice(11)))
}
/** Calendar dates are warehouse-local dates, never UTC conversions. */
export function dateKey(date: Date): string {
return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`