I have a typescript project were I was getting an error around new years. I wrote a simple jest test like this:
const a = new Date(2022, 0, 1);
const b = new Date("2022-01-01");
expect(a).toEqual(b);
and I got FAILED because
// a is "Sat Jan 01 2022 00:00:00 GMT+0100 (Central European Standard Time)"
// b is "Sat Jan 01 2022 01:00:00 GMT+0100 (Central European Standard Time)"
see the difference in time?
What do I not get? It looks to me like this should not happen. Is there a reason for this? thanks so much for your input! happy new year 2022 :)