Getting wrong month in moment.js

后端 未结 1 664
忘了有多久
忘了有多久 2020-12-09 15:22

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?

相关标签:
1条回答
  • 2020-12-09 16:00

    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.

    0 讨论(0)
提交回复
热议问题