Soooooooo TIL that months in JavaScript are 0 indexed so if you are trying to print out a date string you need to do + 1 to the .getMonth() HOW HAVE I NEVER ENCOUNTERED THIS BEFORE
-
Show this thread
-
Replying to @lindseybieda
Every single time I construct a `Date` in JavaScript I do something like `new Date(2019, 5 /* June */, 1)` to hammer home the presence of that insane pitfall
2 replies 0 retweets 5 likes
Replying to @qntm @lindseybieda
Also: const month = date.getMonth() // highly misleading variable name const monthIndex = date.getMonth() // a little safer
11:02 AM - 1 Jun 2019
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.