Add examples

This commit is contained in:
Rohit Tanwar
2018-01-04 13:03:59 +05:30
committed by GitHub
parent a8025b538b
commit eb9f5b9c3a

View File

@ -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"
```