Open josevalim opened 6 months ago
@josevalim This would be great!
I was actually looking into a similar thing the other day. Polars supports calendar math:
This differs from
pl.col("foo") + timedelta
in that it can take months and leap years into account.
Our %Explorer.Duration{}
is equivalent to Python's timedelta
. We may want to consider adding offset_by
support when we add Elixir's Duration if it supports calendar math too.
It will have loss of precision similar to other Calendar types when converted back but one can always cast to integer before/after for full precision. We should also raise if the duration has month or year set.
We need to wait until v1.17.