I'm using JavaScript Date()
utility in my code to get the today's tasks by comparing two different dates.
otApp.TaskPanelUtils.getDaysDiff = function(task)
{
var current = new Date();
var taskDueDate = new Date(task.unformattedDueDate())
return Math.trunc((current.getTime()-taskDueDate.getTime())/otApp.TaskPanelUtils.oneDay);
}
var daysDiff = otApp.TaskPanelUtils.getDaysDiff(taskItem);
if(daysDiff==0 && Math.sign(daysDiff)==0)
{
tempItems.push(taskItem);
}
The above code is working even if I get "-0" negative 0 as result of getDaysDiff()
.
I want to fill tempItems
only in case of positive "0".
Math.sign(-0)
will return -0, then how come comparision with "-0" or -0 is not working?