Dates Without Time in JavaScript: Why new Date('2026-11-29') Shifts by a Day and Why Temporal.PlainDate ExistsBrief · digest for December 2
Brief≈ 2 min

Dates Without Time in JavaScript: Why new Date('2026-11-29') Shifts by a Day and Why Temporal.PlainDate Exists

A user in New York types their birthday into a form: 2026-11-29. Your code passes that string to new Date('2026-11-29'), calls .getDate(), and gets 28. A classic trap.

The issue lies in Date.parse(): a date-only string parses as midnight UTC (00:00:00.000Z). When it's already November 29 in London, it is still 7 p.m. on November 28 in America/New_York (UTC-5). By contrast, a date-time string without an offset ('2026-11-29T00:00:00') parses in local time.

In the new Temporal API, date values without a time or timezone use the immutable Temporal.PlainDate type:

// In America/New_York (UTC-5), Date shifts back one day
const legacyDate = new Date('2026-11-29');
console.log(legacyDate.getDate()); // 28

// Calendar date with no time or timezone
const plainDate = Temporal.PlainDate.from('2026-11-29');
console.log(plainDate.day);   // 29 in every timezone
console.log(plainDate.month); // 11 (1-based months, not 0-based)

No more getUTCDate() workarounds or appending 'T12:00:00': PlainDate stores just the year, month, and day—ideal for birthdays and <input type="date">, with months starting at 1.

In Node.js 26, Temporal works out of the box without flags. Browsers support it in Firefox 139+ and Chrome/Edge 144+, while Safari is still catching up—so broad frontend apps still need a polyfill for now.

Want a deep diveVotes help us choose what to break down in detail. This material has 0 votes.
Sources · 3