Moment.js 也有时长的对象。 将 moment 定义为单个时间点，将 duration 定义为时间的长度。
从概念上讲，时长比 '今天下午2点到4点之间' 更类似于 '2 小时'。 因此，它们不是在依赖上下文的单位之间进行转换的好方法。
Moment.js also has duration objects. Where a moment is defined as single points in time, durations are defined as a length of time.
Durations do not have a defined beginning and end date. They are contextless.
A duration is conceptually more similar to '2 hours' than to 'between 2 and 4 pm today'. As such, they are not a good solution to converting between units that depend on context.
For example, a year can be defined as 366 days, 365 days, 365.25 days, 12 months, or 52 weeks. Trying to convert years to days makes no sense without context. It is much better to use
moment#diff for calculating days or years between two moments than to use