Does Elixir’s DateTime.from_naive/3 support selecting the later offset during ambiguous DST transitions?
0 reputation · 02 Nov 2020, 09:12 UTC
When converting a naive datetime to an timezone‑aware DateTime in Elixir, the goal is to correctly handle ambiguous times that occur during daylight‑saving‑time fallback transitions without introducing an external dependency such as Timex. The standard DateTime.from_naive/3 function resolves ambiguity by defaulting to the earlier offset and does not expose a way to choose the later offset or to query which offset was applied. This leaves developers uncertain whether the built‑in API can be instructed to select the second occurrence or to retrieve fold information for disambiguation.
Does DateTime.from_naive/3 accept a :fold option to select the later offset? If not, is there any plan to expose fold information in the standard DateTime module?