timemachine

Test your time critical app by overriding the native Javascript Date function

timemachine

Test your time-dependent app by monkey patching the Date function and overriding your system time. Timemachine is compatible with global namespaces, RequireJS, CommonJS and NodeJS.

$ bower install timemachine
$ npm install timemachine
timemachine.config({
  dateString: 'December 25, 1991 13:12:59'
});
 
console.log(new Date()); // December 25, 1991 13:12:59 
ParameterDescriptionDefault
dateStringDate you want set as a stringThu, 01 Jan 1970 00:00:00 GMT
timestampDate you want set as a timestamp0
differenceTime offset in milliseconds0
tickWhether the system clock should continue tickingfalse
keepTimeWhether the system time should be keptfalse
timemachine.reset();
console.log(new Date()); // Your real system time