Backend / System Design
Timezone Validation Fix
Overview
A UK-based booking platform allowed workers to submit timesheets before their shift started due to timezone mismatch. The system was using local time instead of UK time.
Problem
- Early submissions were allowed
- Validation was based on local/server time
- Business rules were not aligned with UK timezone
Root Cause
The backend validation logic compared shift times with local time instead of converting current time into UK timezone.
Solution
- Convert current system time into UK timezone for validation
- Compare against shift start time
- Allow submission only if shift has started in UK time
Do not modify stored timestamps. Keep raw user input intact. Timezone logic should exist only in validation layer.
Result
- Blocked early submissions
- Ensured correct business logic enforcement
- Maintained data integrity
- System works correctly across regions
Key Takeaway
Business logic can be timezone-aware, but stored data should remain timezone-agnostic.
