feat(vacay): mirror the leave-year window in the client (#737)

The server owns the arithmetic entitlements are computed with, but the grid has
to render the same twelve months and the overlays have to filter against the
same range, so the window resolves on both sides. yearWindow.ts is that mirror,
including the Feb-29 clamp and the anniversary-without-a-hire-date fallback.

The store loads the settings before the year list picks a default — with a
shifted year the current period is not necessarily the current calendar year.
Holidays are fetched per calendar year the window touches and clipped back to
what the grid draws; a school break straddling New Year comes back from both
fetches, so markers are de-duplicated per day. The label is part of that
identity, otherwise two calendars left on the same colour collapse into one.
This commit is contained in:
Maurice
2026-07-25 11:50:37 +02:00
committed by Maurice
parent 9d93ed95bf
commit e1c5daeccb
5 changed files with 331 additions and 24 deletions
@@ -34,6 +34,19 @@ export const vacayHandlers = [
});
}),
http.get('/api/addons/vacay/year-settings', () => {
return HttpResponse.json({
settings: { year_type: 'calendar', year_start_month: 1, year_start_day: 1, hire_date: null },
});
}),
http.put('/api/addons/vacay/year-settings', async ({ request }) => {
const body = (await request.json()) as Record<string, unknown>;
return HttpResponse.json({
settings: { year_type: 'calendar', year_start_month: 1, year_start_day: 1, hire_date: null, ...body },
});
}),
http.get('/api/addons/vacay/years', () => {
return HttpResponse.json({ years: [2025, 2026] });
}),