Closed puzzfuzz closed 8 years ago
I don't think it's very intuitive for the selected "dates" to have a time of 00:01. It's pretty standard to use a Date
with zeroed time values (i.e. midnight) to represent dates. Wouldn't it be better to just fix the comparison which isn't behaving as wanted?
I haven't got round to testing this yet, but taking a quick look at the moment-range code here, it looks like range#contains
does include the start date (comparison uses <=
). Am I missing something?
@puzzfuzz I agree with @jezstephens , it would be better if this was fixed in moment-range as it seems like a more generic issue.
Moment’s
range.contains
function take timestamps into account when computing if a date is within the given range.CalendarDate
is creating a date at midnight on the day in question, which will never be within the starting range. By setting the day’s time to “one minute past midnight”, this allows the date comparison to behave a bit more logically.