duration()
Signature
duration (number num, String unit)
Parameters
- num
- Type: number
- The length of time in a given unit.
- unit
- Type: String
- A datetime unit. The default is 'milliseconds'. The options are 'years, 'months', 'weeks', 'days', 'hour', 'minutes', 'seconds', 'milliseconds'.
Returns
- Type: Object
- A duration object.
Sample Code
var dur = $A.localizationService.duration(2, 'days');