Add examples
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
###formatDuration
|
||||
### formatDuration
|
||||
|
||||
Returns the human readable format of the given number of milliseconds. If milliseconds is equal to `0` return `'now'` .
|
||||
|
||||
@ -23,3 +23,8 @@ const pluralize = (num, word, plural = word + 's') =>
|
||||
return join(array.reverse(),', ',' and ')
|
||||
}
|
||||
```
|
||||
```js
|
||||
formatDuration(1001); //"1 second and 1 millisecond"
|
||||
formatDuration(343250555); //"3 days, 23 hours, 20 minutes, 50 seconds and 555 milliseconds"
|
||||
formatDuration(34325055574); //"1 year, 1 month, 1 day, 6 hours, 44 minutes, 15 seconds and 574 milliseconds"
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user