I have an JavaScript array here. I need to compare the birthday value with a set date and update the record with a new key value.
var employees = [
{
"internalid":"1",
"name":"Abe Anderson",
"email":"aanderson@javascript.com",
"birthdate":"9/25/1974",
"supervisor":"3",
"2012 Revenue":"100000.00",
"2013 Revenue":"0.00"
}
];
I wrote this here which works great,
for (var i = 0; i < employees.length; i++) {
var cDate = new Date("2014/01/01");
var newDate = cDate.getMonth()+1 + '/' + cDate.getDate() + '/' + cDate.getFullYear();
var eBday = employees[i].birthdate;
}
I'm having a hard time writing the math to compare the two dates correctly. Can anyone help me? I need to calculate how many days left each person has until his or her birthday and update the JavaScript array. I'm stuck!