Elixir and Erlang/OTP versions
Elixir 1.18.4 (compiled with Erlang/OTP 28)
Operating system
x86_64 GNU/Linux
Current behavior
%Date.Range{} where the :first is after :last and a positive :step, when piped to Enum.take/2 with a negative amount does not terminate. For example:
Date.range(~D[2025-09-22], ~D[2025-09-21], 1)
|> Enum.take(-1)
Expected behavior
Date.range(~D[2025-09-22], ~D[2025-09-21], 1)
|> Enum.take(-1)
should return an empty list [], similar to
or
Date.range(~D[2025-09-22], ~D[2025-09-21], 1)
|> Enum.to_list()
|> Enum.take(-1)