I am using Moment to compare two datetime values. Specifically, I am utilizing Moment.isSameOrBefore function. However, my two date values are slightly different due to milliseconds.
I want these two values to be considered the same:
var date1 = '2019-07-09T15:30:05.8670088'
var date2 = '2019-07-09T15:30:06.3400766'
if (moment(date1).isSameOrBefore(date2, 'second')) {
//do something
}
Is there a way to round the datetime values so that they are equal for evaluation to return true? Or is there another method to accomplish this?