Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.18.1 (compiled with Erlang/OTP 27)
Operating system
macOS 14.7.2 (23H311)
Current behavior
These two scripts don't return the same result:
now = ~U[2025-01-04 10:00:00.000000Z]
in_almost_7_days = DateTime.add(now, 7, :day) |> DateTime.add(-1, :microsecond)
DateTime.diff(in_almost_7_days, now, :day)
# Result: 6
now = ~U[2025-02-14 13:33:13.296012Z]
in_almost_7_days = DateTime.add(now, 7, :day) |> DateTime.add(-1, :microsecond)
DateTime.diff(in_almost_7_days, now, :day)
# Result: 7
Expected behavior
I was expecting 6 in both cases.