This is a very common question, however I wasn't able to find a correct answer. I have the following:
tcom
Mon Dec 14 2015 12:22:28 GMT-0500 (PET)
treq
Mon Dec 14 2015 12:18:27 GMT-0500 (PET)
tcom - treq
241122
tdif = new Date(tcom - treq);
Wed Dec 31 1969 19:04:01 GMT-0500 (PET)
I've seen answers like this:Get difference between 2 dates in javascript? but that is a fixed method, I don't know beforehand if the difference is going to be days, hours, minutes or seconds.
Thanks