Hello, I'd like to propose adding the following functions:
- `Date.from_utc_today(duration)` - `NaiveDateTime.from_utc_today(duration)` - `DateTime.from_utc_today(duration)` For example: # Say, now is ~U[2025-01-07 16:22:40.003901Z] iex> Date.from_utc_now(month: 1, day: 1) ~D[2025-02-08] iex> NaiveDateTime.from_utc_now(hour: -1) ~N[2025-01-07 15:22:40.003901] iex> DateTime.from_utc_now(Duration.new!(hour: 1)) ~U[2025-01-07 17:22:40.003901Z] I believe they are especially useful when writing tests and they might give opportunity for some optimizations. Another idea is to instead allow passing `:utc_today` / `:utc_now` to the existing shift/2 functions: iex> Date.shift(:utc_today, month: 1, day: 1) ~D[2025-02-08] iex> NaiveDateTime.shift(:utc_now, hour: -1) ~N[2025-01-07 15:22:40.003901] iex> DateTime.from_utc_now(:utc_now, hour: 1) ~U[2025-01-07 17:22:40.003901Z] Btw and this is a related but separate conversion, I think a `Date.range(date, duration)` would be a nice addition. And so, I believe a `Date.range(:utc_today, month: 1)` would be a natural extension of this. I'm not sure if supporting `Date.add(:utc_today, 1)` and similar is worth it, perhaps just for consistency. -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/elixir-lang-core/2851ea28-d20e-4e8d-b957-38a582f7fa39n%40googlegroups.com.