Interest in PR that implements Date.subtract/2

27 views
Skip to first unread message

Svilen Gospodinov

unread,
May 20, 2019, 5:26:14 AM5/20/19
to elixir-lang-core
Hi everyone,

When I was looking at the `Date` module initially, I found it a bit strange that there is only an `add/2` function; then I noticed in the example in the docs, which uses a negative number as the second param, which makes the add function do subtraction.

I personally got used to the `add/2` function, but more recently I noticed junior engineers being confused why there is no `subtract/2` function (when searching for it in exdocs); we also found that making positive numbers negative (to do subtraction) was a bit of a pain when using `add/2`.

I was going to go ahead an submit (my first!) PR that would basically add `subtract/2` using `add/2` behind the scenes, but before I waste my and anyone else's time, I was wondering if there would be any interest in something like this? What was the rationale for not including `subtract/2` in the first place, perhaps I'm missing something?

Thanks,
Svilen
Reply all
Reply to author
Forward
0 new messages