Why (10-02, 15-02) intersect (10-02, 10-02) is null?
icetbr opened this issue · comments
Simply because moment.range('10-02', '10-02')
has length 0 so there isn't any intersecting period.
If the start and end had different times, there would be an intersection...
Eg.
const m = moment('10-02') // 10-02T00:00:00
const r = moment.range(m.startOf('day'), m.endOf('day'))
moment.range('10-02', '15-02').intersect(r) // 10-02T00:00:00 -> 10-02T23:59:59
// NB: Can do this with range.snapTo('day') after 4.0.0 release
Hope this helps :)
Ok, thanks. I was thinking of a 0 day range as 1 day. Overlaps with adjacent: true does what I was expecting though.