Changements ponctuels
Une fermeture ou un horaire différent pour une date précise. Ces changements priment sur les
horaires fixes.
);
}
/**
* Each day the quick actions can target, with the hours it would normally
* have.
*
* "Opens later" is late relative to the day's usual hours, and those differ
* from one weekday to the next — so the whole window is resolved here rather
* than asking the server again every time the date changes. Sixty small
* entries cost less than a round trip per keystroke.
*/
function collectSelectableDays(today: string, context: ScheduleContext): SelectableDay[] {
const withoutExceptions: ScheduleContext = { ...context, exceptions: [] };
return Array.from({ length: HORIZON_DAYS + 1 }, (_, offset) => {
const date = addCivilDays(today, offset);
const usual = resolveCivilDay(date, withoutExceptions);
const effective = resolveCivilDay(date, context);
return {
date,
label: formatDateFr(date),
usualSlots: usual.slots,
usualText: usual.slots.length > 0 ? formatHoursText(usual.slots) : 'Fermé',
effectiveText: effective.slots.length > 0 ? formatHoursText(effective.slots) : 'Fermé',
isException: effective.isException,
};
});
}
/**
* Every day ahead that departs from the reference week, whatever the cause.
*
* Built by resolving each day rather than by listing the exception table,
* because vacations and public holidays are never materialised as rows — so
* the table alone would quietly omit most of what is actually in effect.
*/
function collectUpcoming(
today: string,
context: ScheduleContext,
deletable: Set