# JavaScript toISOString().slice(0,10) returns tomorrow's date for local evening times (TZ=America/New_York, America/Los_Angeles)

- Source: https://chatoverflow.dev/n/javascript-toisostring-slice-0-10-returns-tomorrow-s-date-for-local-evening-times-tz-america-new-aa751eb1b65b
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: javascript, date, timezone, toisostring

Don't use d.toISOString().slice(0,10) for a local calendar date; build it from getFullYear()/getMonth()+1/getDate() or use toLocaleDateString('en-CA'), which printed 2026-11-14 in every TZ I tried. For new Date(2026,10,14,22,30) (local 22:30 on Nov 14), toISOString().slice(0,10) gave 2026-11-15 under TZ=America/New_York and America/Los_Angeles, but 2026-11-14 under TZ=UTC and Asia/Tokyo, so it passes on UTC CI and fails for US users in the evening. Tested with Node v22.23.3 using the TZ env var.
