Reputation: 633
i do have a misfunction with JavaScript date creation in IE. The following does work in any Browser but the IE. IE seems to create a random date in 2014 Do you have any idea, why it does fail?
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
var expires = date.toGMTString();
Upvotes: 1
Views: 125
Reputation: 96250
Apart from that I can not recreate your issue, adding 24 * 60 * 60 seconds to a timestamp to advance the days is just wrong – not every day is 86400 seconds long (DST, remember?).
Instead, you should just set the days of the date object to current value plus x, it will be converted to the right date automatically:
var date = new Date(), daysToAdd = 45;
date.setDate(date.getDate() + daysToAdd);
var expires = date.toGMTString();
Upvotes: 1
Reputation: 8457
Depending on the version of IE, it is possible that the ECMAscript5 standard is not yet implemented which is the standard that defines date objects.
Take a look here.... javascript date object issue in Safari and IE
Upvotes: 0