Returns the number of years in a duration.
Signature
getYearsInDuration(Duration duration)
Parameters
duration: Type: Duration. The duration object returned by $A.localizationService.duration.
Returns
Type: number The number of years in the duration.
Sample Code
var dur = $A.localizationService.duration(24, 'month');
// Returns 2
$A.localizationService.getYearsInDuration(dur);
See Also