【发布时间】:2015-03-27 14:18:52
【问题描述】:
moment.js 是个新手
我想要 3 种类型的输出
获取一年中的所有月份
在 Moment js 中获取一个月的所有周数
获取一周的所有天数
如何使用moment.js 做到这一点?
我已经尝试了整个月
moment().months(2011);// it's working for my year is 2011
但我只有年份的最后 2 位数字。
moment().months(11);// It's give wrong values or my year is 11
我也看过文件,他们说
moment().months()接受从0到11的数字。如果超出范围,它将冒泡到年份。
当我使用 get days 和 week 时也会出现这个问题
如何在 moment.js 中解决这个问题?
【问题讨论】:
标签: javascript angularjs momentjs