-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
min and max between a ZonedDateTime and a LaxZonedDateTime works admirably well in almost all situations:
julia> dt = ZonedDateTime(2016, 11, 6, winnipeg)
2016-11-06T00:00:00-05:00
julia> lzdt = LaxZonedDateTime(DateTime(2016, 11, 6, 1), winnipeg)
2016-11-06T01:00:00-AMB
julia> min(lzdt, dt)
2016-11-06T00:00:00-05:00
julia> max(dt, lzdt)
2016-11-06T01:00:00-AMB
julia> dt = ZonedDateTime(2016, 11, 6, 2, winnipeg)
2016-11-06T02:00:00-06:00
julia> min(lzdt, dt)
2016-11-06T01:00:00-AMB
julia> max(dt, lzdt)
2016-11-06T02:00:00-06:00That's great! However...
julia> dt = ZonedDateTime(2016, 11, 6, 1, 30, winnipeg, 2)
2016-11-06T01:30:00-06:00
julia> lzdt = LaxZonedDateTime(DateTime(2016, 11, 6, 1), winnipeg)
2016-11-06T01:00:00-AMB
julia> min(dt, lzdt)
2016-11-06T01:00:00-AMB
julia> max(dt, lzdt)
2016-11-06T01:30:00-06:00When the LaxZonedDateTime is ambiguous, it appears that min(dt::ZonedDateTime, lzdt::LaxZonedDateTime) will always return lzdt (provided dt is within the same period of potential ambiguity) and max will always return dt, even in the above case where it is impossible for lzdt to be less than dt.
Honestly I'm not sure this worth fixing. But it is certainly worth being aware of.
Reactions are currently unavailable