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:
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.