- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Date Pitfalls
JavaScript Dates
JavaScript Date Pitfalls
A few date behaviours catch out almost every JavaScript developer.
The Date API is one of the oldest parts of the language.
Knowing its four main traps prevents most date bugs.
Example
Example
javascript
const date = new Date(2026, 1, 30);
console.log(date.getMonth());
console.log(date.getDate());February has no 30th, so it rolled over into March.
