Expand description
Core shift calculation functions.
All functions are pure: given the same inputs, always produce the same outputs. No platform dependencies, no I/O, no state.
§The algorithm
date → calculate_day_offset(date, reference_date)
→ normalize_cycle_index(offset, cycle_length)
→ cycle[index] → ShiftTypeTeam phase offset is added to the day offset before normalization:
offset = (date - reference_date) + team_phase_offsetFunctions§
- calculate_
day_ offset - Number of days between
dateandreference_date. - get_
shift_ info - Get full shift info (date, day of cycle, cycle index, shift type) in one call.
- get_
shift_ type_ for_ date - Get the shift type for a given date.
- normalize_
cycle_ index - Normalize any offset into the range
0..cycle_length. - team_
phase_ offset_ for - Team phase offset in days.