Created
October 30, 2019 01:54
-
-
Save marquesm91/070979b0770bfb29b4831a115fa04290 to your computer and use it in GitHub Desktop.
Date Mock
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
// https://github.com/facebook/jest/issues/2234#issuecomment-397321562 | |
let currentDate; | |
beforeAll(() => { | |
currentDate = new Date(); | |
const RealDate = Date; | |
global.Date = jest.fn(() => new RealDate(currentDate.toISOString())); | |
Object.assign(Date, RealDate); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment