Simple age calculation not working correctly

I'm trying to calculate a persons age based on todays date minus their birthday.

In this case i'm using these dates

Thu Nov 03 1988 00:00:00 GMT-0500 (Central Daylight Time)
Tue Aug 12 2014 11:56:33 GMT-0500 (Central Daylight Time)

method

var birthday = new Date(user.birthTime);
var today = new Date();
console.log(birthday);
console.log(today);

console.log('age = '+Math.floor((today - birthday)/(1000*60*60*24)));

// Today minus birthday divided by .... (not sure where all these numbers come from but everyone on the internet uses them so they must be right?)
return Math.floor((today - birthday)/(1000*60*60*24));

The code returns 9413 when i'm expecting 26.

How can i get the persons age in years?

That's the age in days, not years.

Date arithmetics in JavaScript will yield values in milliseconds, you divide them by 1000*60*60*24 so you end up with a result in days (milliseconds in a second * seconds in a minute * minutes in an hour * hours in a day).

Try dividing it by 1000*60*60*24*365.

You are getting the age in days. If you want the age in years, you need to divide that last calculation by 365

Math.floor((today - birthday)/(1000*60*60*24))/365