Here's the code to reproduce it:
import timezoneMock from 'timezone-mock';
import { utc } from '@date-fns/utc';
it('breaks', () => {
timezoneMock.register('US/Eastern')
const now = new Date();
expect(isSameDay(now, now, { in: utc })).toBeTrue;
timezoneMock.unregister();
});
I think deep in the bowls of either date-fns or ttimezoneMock, it's passing UTCDate through, and not the mocked date. But I can't be sure unfortunately.
Have I used isSameDay
or timezoneMock
wrong?
If not I'll raise this as a bug on a backlog somewhere?