new Date(2026, 11, 25) is Christmas, not Thanksgiving week
JavaScript numbers months from 0 and days from 1, so the obvious date is off by a month. The quirk was copied from Java in 1995, and it still bites every December.
Wrongnew Date(2026, 11, 26) // meant November 26
Rightnew Date(2026, 10, 26) // November is 10; or parse "2026-11-26T00:00" and let the string say 11
What people get wrong#
You want a date object for Thanksgiving, November 26, 2026. You write the numbers you'd write on a form:
new Date(2026, 11, 26) // Sat Dec 26 2026 00:00:00
That's Boxing Day. In the JavaScript Date constructor, the second argument is monthIndex, which MDN defines as an "integer value representing the month, beginning with 0 for January to 11 for December" (MDN: Date() constructor). The day argument, meanwhile, starts at 1. So 11 means December, and 26 means the 26th.
The same rule applies on the way out. getMonth() returns "an integer, between 0 and 11," so code that prints date.getMonth() + "/" + date.getDate() turns November 26 into "10/26."
Why it doesn't throw an error#
The worst part is that a wrong month never fails loudly. MDN explains that out-of-range values "carry over": a month index above 11 rolls into the next year, so new Date(1990, 12, 1) is January 1, 1991. Values that underflow borrow instead: new Date(2020, 5, 0) is May 31, 2020 (MDN).
So the classic one-month-off bug doesn't produce Invalid Date. It produces a perfectly valid, wrong date. Write new Date(2026, 12, 25) meaning Christmas and you'll get January 25, 2027, without a warning. Bugs like this hide in test suites that only check dates early in the year and then surface in December, when the "12" finally overflows.
Why it happens#
JavaScript inherited the convention. In their history of the language, Allen Wirfs-Brock and Brendan Eich write that JavaScript 1.0's Date "was a direct transliteration, bugs and all, of the java.util.Date class of Java 1.0," including "externally numbering months from 0–11" and the Java design's Year 2000 ambiguities. The choice was made for Java interoperability (Wirfs-Brock & Eich, HOPL 2020). Java's own documentation still spells out the rule: "A month is represented by an integer from 0 to 11; 0 is January," while the day of the month runs "from 1 to 31" (Oracle: java.util.Date).
There is a logic to it. MDN notes that a zero-based month is "useful for indexing into arrays of months," so monthNames[date.getMonth()] just works. But that convenience is for the programmer building a lookup table, not for the person reading 11 in a function call.
A cousin of the bug: getDay() is not the day of the month. It returns the weekday, "0 for Sunday, 1 for Monday," and so on (MDN: getDay()). The day of the month is getDate(). Yes, really.
The fix#
const thanksgiving = new Date(2026, 11, 26);
const thanksgiving = new Date(2026, 10, 26); // 10 = November
The month argument is an index from 0; the day argument is a calendar number from 1.
- Never print
getMonth()raw. Add 1 for display, or better, format withIntl.DateTimeFormatortoLocaleDateString(), which handle month names and ordering for you. - Use named constants if you build dates from numbers:
const NOV = 10makes the intent reviewable. - Prefer ISO strings with a time when the date is known up front.
new Date("2026-11-26T00:00")reads the month as 11 because it's text. Be careful with date-only strings, though: MDN's Date.parse() examples note that"2019-01-01"implies UTC "because it's date-only," while a date with a time and no zone is read as local time. West of Greenwich, a date-only string can display as the previous day. - Test December. Add a unit test for a date in month 12 of your mental model. It's where the off-by-one shows.
Is a fix coming?#
Yes. The new Temporal API numbers months the way humans do. MDN describes Temporal.PlainDate's month as "the 1-based month index," and adds pointedly that "unlike Date.prototype.getMonth(), the index is 1-based" (MDN: Temporal.PlainDate). MDN still marks it as limited availability, not yet Baseline, so check your target browsers before relying on it. Until then, Date keeps the 1995 rule, and December stays 11.
Sources
Every factual claim on this page links to one of these. Checked November 21, 2026. See how we source.
- MDN: Date() constructor developer.mozilla.org
- MDN: Date.prototype.getMonth() developer.mozilla.org
- MDN: Date.prototype.getDay() developer.mozilla.org
- MDN: Date.parse() developer.mozilla.org
- Wirfs-Brock & Eich: JavaScript: The First 20 Years (HOPL 2020, PDF) wirfs-brock.com
- Oracle Java SE 8 API: java.util.Date docs.oracle.com
- MDN: Temporal.PlainDate developer.mozilla.org