moment.duration().get(String);
作为 Duration#x() 获取器的替代,可以使用 Duration#get('x')。
同样,moment#add 中的所有简写键也适用于此。
duration.get('hours');
duration.get('minutes');
duration.get('seconds');
duration.get('milliseconds');
无效的时长将会为所有单位返回 NaN。
moment.duration().get(String);
As an alternate to Duration#x() getters, you can use Duration#get('x'). All the shorthand keys from moment#add apply here as well.
duration.get('hours');
duration.get('minutes');
duration.get('seconds');
duration.get('milliseconds');
Invalid durations return NaN for all units.