I am using MomentJS to calculate the difference between two times. The weird thing is about this library is the difference between today and today is 0. The difference between today and tomorrow is -0.
My question is, how do I differentiate between 0 and -0. It seems JavaScript treats them the same.
So for example if I write the following code:
if (tomorrow === -0)
console.log('It is tomorrow!');
else if (tomorrow === 0)
console.log('It is today!');
Here's an example on JSFiddle as to how it handles the returned values (I am in Australia so depending on where you are in the word you may have to adjust the today and tomorrow dates)