mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
Only medication intake bounded its capture instant — a hand-rolled POST or a faulty import could backdate a measurement to epoch zero or forward-date a mood entry into next year, and both sailed through validation. Extract the intake bound into a shared `validateEntryInstant` helper: reject any instant more than a five-minute clock-skew tolerance in the future, and reject anything before a 1900 far-past floor. Callers can clamp the past window tighter — medication intake keeps its five-year floor — and override the past-bound message to preserve an established contract. Apply it to the measurement create/edit schema (`measuredAt`), the mood schema (`moodLoggedAt`), and the cycle period + day-log (`loggedAt`); medication intake now delegates to the same helper. The capture forms gain a matching `max` on the datetime picker so a future instant can't be selected in the UI either. The wire shape is unchanged, so the OpenAPI contract holds.