Last active
May 22, 2024 16:28
-
-
Save iwstkhr/bc5ec75f816f92e1afc77b49e60c3faf to your computer and use it in GitHub Desktop.
Mocking JavaScript Date Class with Jest
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
// For timer mocks, see https://jestjs.io/docs/timer-mocks | |
// For setSystemTime, see https://jestjs.io/docs/jest-object#jestsetsystemtimenow-number--date | |
jest.useFakeTimers().setSystemTime(new Date('2023-01-02 12:34:56')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment