I am not so into JavaScript and I have to check if 2 date have the same day\month\year (not the time, so only if the day is the same). I have to use only old plain JavaScript
I have 2 Date variable and I was trying to do in this way:
if(previousDate.getDate() === dateCurrentForecast.getDate()) {
console.log("SAME DATE");
}
Where:
previousDate = Sun Nov 05 2017 06:00:00 GMT+0100 (ora solare Europa occidentale)
dateCurrentForecast = Sun Nov 05 2017 12:00:00 GMT+0100 (ora solare Europa occidentale)
I have to find a way to check that these 2 date are in the same day (Sun Nov 05 2017).
Using the previous snipet it seems to work because both previousDate.getDate() and dateCurrentForecast.getDate() returns the value 5, but what exactly means this returned value?
What is the correct way to do this kind of check?