-
Notifications
You must be signed in to change notification settings - Fork 399
Open
Description
This is pretty niche, but I forgot which version of Elixir allowed dates to have negative years, I've been using it for a project of mine with great success, until I needed to use some Timex.diff/3 on it, granted I could just use Date.diff/2 in some cases, but if anything outside of days is required, well...
Steps to reproduce
Timex.diff(~D[-1755-01-01], Date.utc_today(), :years)Description of issue
** (FunctionClauseError) no function clause matching in :calendar.last_day_of_the_month/2
The following arguments were given to :calendar.last_day_of_the_month/2:
# 1
-1755
# 2
1
(stdlib 6.1) calendar.erl:373: :calendar.last_day_of_the_month/2
(stdlib 6.1) calendar.erl:222: :calendar.date_to_gregorian_days/3
(stdlib 6.1) calendar.erl:252: :calendar.datetime_to_gregorian_seconds/1
(timex 3.7.11) lib/date/date.ex:16: Timex.Protocol.Date.to_gregorian_microseconds/1
(timex 3.7.11) lib/comparable/diff.ex:15: Timex.Comparable.Diff.diff/3
iex:2: (file)
So there might be room to utilize Elixir's date/time modules in more places rather than relying on erlang's calendar, I have no idea what it would take to make this work (not that familiar with the internals of Timex)
Metadata
Metadata
Assignees
Labels
No labels