Handling ambiguous local times during DST transitions in Erlang
0 reputation · 26 Dec 2024, 20:46 UTC
When using the erlang_time module to convert UTC timestamps to local time, a specific challenge arises during the 'fold' period of a Daylight Saving Time transition. In these instances, the same local time occurs twice as the clock shifts back.
The current behavior of erlang_time:from_local/1 relies on the host system's IANA time zone database but appears to default to the first occurrence of the ambiguous hour without notification. There is no native parameter or high-level API flag to specify whether the first or second instance should be selected during the conversion process.
Does Erlang provide a mechanism to resolve these ambiguous local times without manually calculating and injecting offsets? If not, what is the recommended pattern for ensuring the correct offset is applied during a DST end-transition fold?