When working with a Date retrieved from a Mongo query in ISO format, the goal is to compare it with today's date. To accomplish this, a new Date is created and its time is set to zero:
var today = new Date();
today.setHours(0,0,0,0); //Sat Jan 20 2018 00:00:00 GMT-0800 (PST)
While this method sets the time to zero, the issue arises when converting it to an ISO string for comparison:
console.log(today.toISOString()); //2018-01-20T08:00:00.000Z
The hour remains at 08 instead of being set to zero. This discrepancy makes setting the hour to zero challenging.