Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting wrong month in moment.js

I'm using Moment.js included through RequireJS. When I call Moment().month(), instead of number 11 I always get number 10. Any ideas how can this happen?

like image 804
Ladislav M Avatar asked Nov 20 '13 11:11

Ladislav M


1 Answers

According to the documentation, months are zero indexed. So January is 0 and December is 11. moment().month() would give the zero based index of the current month (November) which is 10.

like image 183
Gnagy Avatar answered Oct 07 '22 16:10

Gnagy