The Many Quirks of JavaScript Dates

JavaScript dates are weird. Famously, Brendan Eich wrote the first version of JavaScript in 10 days - and the Date function itself was no exception. It is based on code that was ultimately deprecated in Java.

That means JavaScript has inherited a Date function which was found to be buggy and problematic in Java, leaving it full of issues. You may have even encountered some problems yourself. You may be wondering, then, "what's so weird about it?". Let's look at all the quirks and common pitfalls with JavaScript's Date constructor so that you can avoid them.