From eb9f5b9c3aea7ea325a2c8898459577671919590 Mon Sep 17 00:00:00 2001 From: Rohit Tanwar <31792358+kriadmin@users.noreply.github.com> Date: Thu, 4 Jan 2018 13:03:59 +0530 Subject: [PATCH] Add examples --- snippets/formatDuration.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/snippets/formatDuration.md b/snippets/formatDuration.md index ea8e3325b..05884fa48 100644 --- a/snippets/formatDuration.md +++ b/snippets/formatDuration.md @@ -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" +```