Replies: 1 comment 3 replies
-
Very common mistake, the Date constructor takes a month index (0-11), so 1 does represent February. console.log(new Date(2014, 1, 11).toString()) // Tue Feb 11 2014 00:00:00 GMT-0500 (Eastern Standard Time) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
On the first page of the docs themselves, the site says:
format(new Date(2014, 1, 11), 'MM/dd/yyyy')
//=> '02/11/2014'
My question is... why?? When we input 1 for the month, why doesn't it stay as 1 when formatted, and why doesn't it produce January?? What am I missing?
Beta Was this translation helpful? Give feedback.
All reactions