displayDuration()

Displays a length of time.

Signature

displayDuration (Duration duration, boolean withSuffix)

Parameters

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

withSuffix: Type: boolean. If true, returns value with a suffix matching the unit of the duration parameter.

Returns

Type: String The length of time.

Sample Code

1var dur = $A.localizationService.duration(1, 'day');
2// Returns "a day"
3var length = $A.localizationService.displayDuration(dur);