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

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