Comparing Durations....
Wasn't today but have been working on adding :duration, Ash.Type.Duration to Ash as want it for my AshNeo4j datalayer, etc., and learned that while Durations can be added and subtracted, they aren't so easy to compare, particularly when larger inability to compare weeks and months without a reference instant. So we don't have a comparator on Durations, although durations small enough to convert to timeout (with Kernel to_timeout) can be.
That said durations are really useful in expressions, in Ash we've added support so they can be added/subtracted from temporal types DateTime|Date|Time|NaiveDateTime which uses the respective shift, (subtract also uses Duration.negate()), with the result the same temporal type. Durations can be added and subtracted with result in duration. Durations can also be negated.
0 Replies