getMonthsInDuration()

Returns the number of months in a duration.

Signature 

getMonthsInDuration(Duration duration)

Parameters 

duration: Type: Duration. The duration object returned by $A.localizationService.duration.

Returns 

Type: number The number of months in the duration.

Sample Code 

1var dur = $A.localizationService.duration(70, 'day');
2// Returns 2, the number of months in the given duration
3$A.localizationService.getMonthsInDuration(dur);

See Also