I've got the following code that checks to see whether the start date is >= to the end date. Almost every time I compare the two dates when they are identical, the difference between the dates is something less than 0.
Here is my code:
var end = $('#job_end').datetimepicker('date');
var start = $('#job_start').datetimepicker('date');
console.log(start);
console.log(end);
console.log(start.diff(end));
console.log(start.isSameOrAfter(end));
Here is the output from this code:
Moment {_isAMomentObject: true, _isUTC: false, _pf: {…}, _locale: Locale, _d: Wed Jul 25 2018 14:15:00 GMT-0500 (Central Daylight Time), …}
Moment {_isAMomentObject: true, _isUTC: false, _pf: {…}, _locale: Locale, _d: Wed Jul 25 2018 14:15:00 GMT-0500 (Central Daylight Time), …}
-6
false
Is there something that I am doing wrong?