Dates with ranges and intervals


#1

I’m considering an issue where all the elements are time stamps. An array of these elements can contain a single time stamp, an array, a range, an interval or combination of these. By range I intend a construction using such as collect(range(,)) which produces an array of discrete items, and by interval I intend a 2-something containing a lower and upper bound, indicating all values on the real line between the two bounds.

My thoughts so far are that if I indicate an interval as a 2-tuple then in a given mixed array I can distinguish a bounded interval from a 2-array based on its type. Just wondering if there has been prior thinking of this issue, and what the true Julia approach would be?


#2

Hard to say but I believe a “true Julian approach” would think of a single time stamp, and an AbstractVector (array, range, interval) of timestamps as two different things, though your array could support both if needed. Have a look at TimeSeries.jl for a nice package working with times.


#3

IntervalSets.jl might be useful?


#4

Yes, Tim, very apposite, good call. I was concerned about the treatment of unions of disjoint intervals for my purposes, but I see there has been previous discussion on this on GitHub and will try to catch up. At least the type definitions and basic ops will be very useful.