Mocking dates in jest

Updated November 29, 2022
Created November 21, 2019


new Date(Date.now())

const dateSpy = jest.spy(Date, "now")

Credit to Hugo's post


Comments?