Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There's also the equivalent Date.now() (as of ES5). If you'd like to write test code that overrides the current Date, this is the easiest version to override. Monkey-patching Date's constructor is a disaster. Plus, backwards compatibility can easy be added (see https://developer.mozilla.org/en/JavaScript/Reference/Global...) to non-ES5-compliant browsers.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: