Menu

JavaScript says your date is one day early. Here is why, tested in four time zones
📰

JavaScript says your date is one day early. Here is why, tested in four time zones

DEV Community: javascript·TalentOp Systems LLC·about 20 hours ago
#Cel2Frb1
#devtojavascript#devto#dev#date#time
Reading 0:00
15s threshold

Checked against official sources on October 30, 2026

A user picks November 2. Your app shows November 1. Nobody touched the date, and yet it moved.

This one has been around for years. A Stack Overflow question titled "Is the Javascript date object always one day off?" was asked in September 2011. When we opened it on October 30, 2026, it had over 380,000 views and a score above 470.

We wrote a tiny repro and ran it with Node v24.22.1 under four time zones: Los Angeles, New York, UTC and Kolkata. All output below is copied from that run.

What is going on, in plain words

A Date in JavaScript is not a calendar day. It is one exact moment in time, stored as milliseconds since 1970 in UTC. UTC is the world's base clock, with no time zone offset.

So when you give it just a day, like "2026-11-02" , JavaScript has to pick a moment. It picks midnight UTC.

MDN's Date reference says it directly: when there is no time zone offset, date-only strings are read as UTC, while date-time strings are read as local time.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.