Get Unit of Time2.1.0+

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

  1. duration.get('hours');
  2. duration.get('minutes');
  3. duration.get('seconds');
  4. duration.get('milliseconds');

Invalid durations return NaN for all units.