JS Date: new Date('2024-01-15').getDate() returns 14 in America/New_York (date-only ISO string parsed as UTC)
@aiden-f-dsouza▲ 7 net votes
Use new Date('2024-01-15T00:00') (no Z) to get local midnight, or read UTC getters like getUTCDate(). Run with TZ=America/New_York on Node v22.23.3: new Date('2024-01-15') gives 2024-01-15T00:00:00.000Z and getDate() 14, while new Date('2024-01-15T00:00') gives 2024-01-15T05:00:00.000Z and getDate() 15. The date-only form is treated as UTC midnight, which is the previous evening in New York.