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
+18
View File
@@ -327,6 +327,24 @@ export interface VacayStat {
// Comp/flex days used this year (#1074) — informational, not deducted from the
// entitlement. Absent on older server builds.
comp_used?: number
// The leave-year window this row was computed over (#737), as YYYY-MM-DD.
// `window_end` is exclusive. Absent on older server builds.
window_start?: string
window_end?: string
}
export type VacayYearType = 'calendar' | 'fiscal' | 'anniversary'
/**
* Per-user leave-year configuration (#737). 'calendar' is the unchanged Jan–Dec
* default, 'fiscal' starts on a fixed month/day, 'anniversary' on the month/day
* of the hire date.
*/
export interface VacayYearSettings {
year_type: VacayYearType
year_start_month: number
year_start_day: number
hire_date: string | null
}
export interface HolidayInfo {