Open
Description
Steps to reproduce
with Elixir v1.13
iex(1)> now = ~U[2023-01-01 10:20:30Z]
~U[2023-01-01 10:20:30Z]
iex(2)> Timex.shift(now, hours: 1)
~U[2023-01-01 11:20:30Z] # OK
with Elixir v1.14
iex(1)> now = ~U[2023-01-01 10:20:30Z]
~U[2023-01-01 10:20:30Z]
iex(2)> Timex.shift(now, hours: 1)
~U[2023-01-01 11:20:30.000000Z] # precision changes unnecessarily
Description of issue
- Elixir v1.14 changes DateTime.add/4 behaviour to preserve the maximum precision of given parameters.
- Timex.shift/2 uses DateTime.add/4 with
:microsecond
precision to apply time-shift result.timex/lib/datetime/datetime.ex
Line 450 in e1c4d42
This causes unnecessary precision conversions in Elixir v1.14 and later.
Metadata
Metadata
Assignees
Labels
No labels