When using the JavaScript function Date.now in IE8 you may receive the following error:

‘Object doesn’t support this property or method’

This is caused by the fact that Date.now()wasn’t added to the JavaScript specification until ECMAScript 5. If you look at the functions entry on MSDN you will find the following under the requirements section:

‘Not supported in installed versions earlier than Internet Explorer 9. However, it is supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards. Also supported in Windows Store apps.’

What this little gem means that even if you switch the document mode in IE9 onwards you wont hit this issue! The only way to test for this issue is to actually have IE8 installed.

Fortunately, there is a simple solution to this issue which I found on Ari Fuchs Tumblr. To fix the issue just add the following to the top of any javascript file that used the Date.now function:

Date.now = Date.now || function() { return +new Date; };

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

required