rotaready / moment-range

Fancy date ranges for Moment.js
The Unlicense
1.69k stars 202 forks source link

.overlaps & .contains always returning false #285

Open bdcarr opened 4 years ago

bdcarr commented 4 years ago

I feel like I must be doing something wrong here (copy/paste from node REPL):

> const tsRange = moment.range(moment.unix(1563224400), moment.unix(1563234000))
undefined
> const discardRange = moment('2020-07-16').range('day')
undefined
> discardRange.toString()
'2020-07-16T00:00:00+10:00/2020-07-16T23:59:59+10:00'
> tsRange.toString()
'2019-07-16T07:00:00+10:00/2019-07-16T09:40:00+10:00'
> tsRange.contains(discardRange)
false
> discardRange.contains(tsRange)
false
> tsRange.overlaps(discardRange)
false
> discardRange.overlaps(tsRange)
false

Running v4.0.2