Andrew's Digital Garden

Dates in JS are tricky

When the time zone offset is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as a local time

const date = new Date('2025-09-20'); const localDate = new Date(2025, 8, 20);

The former is treated as UTC time, and the latter is interpreted as local time. This can be a little confusing, as depending on your timezone, creating the date with the former example can mean you've actually created yesterday in your timezone.

Also note that monthIndex in JS is zero-indexed.

Also note that DateTimeFormat by default doesn't change the time zone, merely the format.

[[js]]

Dates in JS are tricky