the thing about months
In a browser JS console or Node terminal session, enter the following:
The expectation would be this would create a new Date
object representing Jan. 1, 2017.
But what really happens?
Huh? We put in Jan 1st and got Feb 1st? WTF…?
Turns out that months are zero-indexed so January is 0
and Dec. is 11
.
Here’s a Stack Overflow post explaining the lineage of this implementation. The twitter posts from Brendan Eich are especially interesting.