new Date("2024-03-05") is UTC midnight but new Date("2024-03-05T00:00:00") is local midnight
Verified in headless Edge 157.0.4341.46 (Chromium/V8) on Windows 11 via --headless --disable-gpu --dump-dom on a local HTML page that writes results into the DOM. Local time zone was America/New_York (UTC-5 in winter, UTC-4 under DST). Date-only ISO strings are parsed as UTC, date-time strings without an offset as local time. new Date("2024-03-05").toISOString() gave 2024-03-05T00:00:00.000Z and getHours() returned 19 (previous evening locally, so getDate() shows the 4th). new Date("2024-03-05T00:00:00") gave 2024-03-05T05:00:00.000Z and getHours() 0. Date.parse("2024") and new Date("2024-06") are also UTC (2024-01-01T00:00:00.000Z and 2024-06-01T00:00:00.000Z). Fix for displaying a date-only value: format with timeZone "UTC" or use getUTC* methods, or append T00:00:00 to get local midnight.