Created
November 7, 2018 16:23
-
-
Save galileopy/80bb476ba516e8770222d708a93e8c93 to your computer and use it in GitHub Desktop.
Mocks the global Date class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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