Permalink
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (14 sloc) 424 Bytes
title version signature
Get Unit of Time
2.1.0
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.