Story #14 Time Zone Handling · Date-Time APIs

The Daylight-Saving-Time Scheduling Failure

"Identical-looking schedule requests produced different outcomes in different regions, twice a year"

A logistics API accepted local pickup times but silently normalized times that fell in DST transition gaps, and chose an offset for ambiguous times without documenting the choice. Systems that looked identical on the surface disagreed about the actual pickup instant.

What happened

Global Logistics Corp’s shipment scheduling API accepted a local pickup date/time and warehouse location, then returned a UTC timestamp. During development, tests used ordinary weekday dates in a single time zone. All tests passed.

The failure surfaced during the spring DST transition. Warehouses submitted pickup windows that fell inside the hour skipped when clocks moved forward. The API silently normalized those nonexistent times instead of rejecting them or applying a documented rule. In autumn, an ambiguous hour—the one that occurs twice—was resolved silently with no indication of which occurrence had been chosen.

Carrier systems, warehouse applications, and customer portals each interpreted the resulting timestamps slightly differently. Some carriers arrived an hour early. Others missed dispatch windows. Customer delivery estimates were inconsistent across channels. Support teams couldn’t explain why identical-looking requests produced different outcomes.

Root cause

Unit tests covered date parsing but not DST transitions, ambiguous local times, or invalid local times. The API had no documented policy for these edge cases, and its response didn’t provide enough information for consumers to detect how a local time had been interpreted.

The fix

The API was updated to require UTC offsets in all time-sensitive requests, with explicit documentation for disambiguation behavior. API-level contract tests were added for DST transitions across all supported time zones, covering the spring gap, autumn ambiguity, and boundary conditions.

Lesson learned

Date-time APIs must be tested against real calendar edge cases—DST transitions, ambiguous local times, and invalid local times—not just ordinary weekday dates. Failure to handle these cases produces bugs that appear twice a year and are very hard to reproduce in development.

The Daylight-Saving-Time Scheduling Failure