Very cool, thank you, but, why are the arguments of duration
limited to integers and dates…? Wouldn’t it be better to define it along similar lines to the implementation of width
:
function duration(A::AbstractInterval)
_width = rightendpoint(A) - leftendpoint(A)
max(zero(_width), _width + oneunit(_width)) # this works when T is a Date
end
This way it should work with any typed interval.