weeks()


moment.duration().weeks();
moment.duration().asWeeks();

与时长的其他获取器一样,moment.duration().weeks() 用于获取星期数(0-4)。

moment.duration().asWeeks() 用于获取时长的长度(以星期为单位)。

与时长的其他获取器不同,星期数获取器是作为天数的子集,且不会从天数中扣除。

注意:以星期为单位的时长的长度定义为 7 天。

moment.duration().weeks();
moment.duration().asWeeks();

As with the other getters for durations, moment.duration().weeks() gets the weeks (0 - 4).

moment.duration().asWeeks() gets the length of the duration in weeks.

Pay attention that unlike the other getters for duration, weeks are counted as a subset of the days, and are not taken off the days count.

Note: The length of a duration in weeks is defined as 7 days.