Skip to content

Instantly share code, notes, and snippets.

@galileopy
Created November 7, 2018 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save galileopy/80bb476ba516e8770222d708a93e8c93 to your computer and use it in GitHub Desktop.
Save galileopy/80bb476ba516e8770222d708a93e8c93 to your computer and use it in GitHub Desktop.
Mocks the global Date class
function mockDate(date) {
Date = class extends Date {
constructor() {
return super(date);
}
};
}
mockDate('2018-02-28T09:39:59');
console.log(new Date())
console.log(Date.now())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment