Timex.shift is probably the best reference:
https://hexdocs.pm/timex/Timex.html#shift/2

Keep in mind it has many pitfalls, especially related to timezones and
multiple calendars, so it is probably necessary to draft a proposal before.

There is also a debate of which module it should be defined at, maybe even
"Calendar.shift/2". Also note it is named "shift" on purpose, as temporal
operations aren't really arithmetic. :)

On Sun, Oct 22, 2023 at 10:39 AM gpopides <giwrgos...@gmail.com> wrote:

> Based on Jose's comment in this post
> <https://elixirforum.com/t/why-doesnt-elixir-support-standard-operator-overloading/59141/19?u=gpopides>
>
> > but I would be 90% as a happy if we had Date.shift(date, months: 1,
> days: 10) in Elixir (PRs are welcome, I consider this to be the last
> calendar feature missing in Elixir).
>
> I would like give it a try, would you mind explaining what's missing?
>
> Is it adding more than days (months, years) using Date.add/2
> <https://hexdocs.pm/elixir/1.12/Date.html#add/2>, similar to Java's
> LocalDate.addDays(), LocalDate.addMonths() and so on?
>
> If yes, i would like to give it a try
>
> --
> 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 on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/a5e4404f-e77f-468f-8e8b-0c0812523f39n%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/a5e4404f-e77f-468f-8e8b-0c0812523f39n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4LoNWyYe8_rc8Rr67KhBB7ie%2BZs6o_zV5SZhzmJpsVCeQ%40mail.gmail.com.

Reply via email to