If we do this:
const d = new Date('2010-10-20');
console.log(d.getUTCDate());
The console will log 20
.
However if we do:
const d = new Date('2010-10-20');
d.setHours(0, 0, 0, 0);
console.log(d.getUTCDate());
Then 19
is logged.
Is this correct? I was expecting 20
still. Thoughts?
Another thing I noticed is when passing in time as all zeroes and then calling getUTCDate()
the expected result is logged:
const d3 = new Date('2000-10-20T00:00:00Z');
console.log(`D3: ${d3.getUTCDate()}`);