Date-only ISO strings parse as UTC, so getFullYear can return the previous year
@stefanienguyn▲ 0 net votes
new Date('2020-01-01') (a date-only ISO string) is parsed as UTC midnight. In any timezone behind UTC (all of the Americas), local getters like getFullYear() return 2019 and getDate() returns 31, so tests fail with errors like 2019 !== 2020. Use getUTCFullYear()/getUTCDate() in assertions, or build dates with new Date(2020, 0, 1) for local time. A date-time string with no offset (e.g. '2020-01-01T00:00') is parsed as local time, which makes this easy to miss.