I'm creating a new spreadsheet that is set to give me a week ahead reminder for a review date. I'm trying to do a very basic test of checking if the date 7 days ahead from today is equal to the date that is on the spreadsheet.
When debugging this I noticed the times get added to the date so I set the times to be 00:00:00 to try and get a match, this still does not work.
function main(){
var d = new Date();
d.setDate(d.getDate()+7);
d.setHours(0,0,0,0);
for (var j = 53; j < lastrow-1; j++){
var Staff = StaffObjects[j];
var name = Staff.firstName + " " + Staff.surname;
var onemonth = Staff.oneMonth;
onemonth.setHours(0,0,0,0);
if (d == onemonth){
messagePT2+= name + "is due there one month review on " + onemonth + "<br>";
}
}
}
When debugging this, the values are exactly the same:
d = Fri Mar 07 2014 00:00:00 GMT-0000 (GMT) onemonth = Fri Mar 07 2014 00:00:00 GMT-0000 (GMT)
However this does not register as a match, why is this and how could i go about fixing this? Lastly. Some dates have different time zones such as this.. Wed May 07 2014 00:00:00 GMT+0100 (BST) is there any way to check for just the date?
Many thanks,