fix: show overnight appointments on each covered calendar day
This commit is contained in:
@@ -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')}`
|
||||
|
||||
Reference in New Issue
Block a user