Apply new format to snippets and template

This commit is contained in:
Angelos Chalaris
2020-09-15 16:28:04 +03:00
parent 040efd4380
commit 53c16dbf65
401 changed files with 969 additions and 950 deletions

View File

@ -5,10 +5,10 @@ tags: date,math,string,intermediate
Returns the human readable format of the given number of milliseconds.
Divide `ms` with the appropriate values to obtain the appropriate values for `day`, `hour`, `minute`, `second` and `millisecond`.
Use `Object.entries()` with `Array.prototype.filter()` to keep only non-zero values.
Use `Array.prototype.map()` to create the string for each value, pluralizing appropriately.
Use `String.prototype.join(', ')` to combine the values into a string.
- Divide `ms` with the appropriate values to obtain the appropriate values for `day`, `hour`, `minute`, `second` and `millisecond`.
- Use `Object.entries()` with `Array.prototype.filter()` to keep only non-zero values.
- Use `Array.prototype.map()` to create the string for each value, pluralizing appropriately.
- Use `String.prototype.join(', ')` to combine the values into a string.
```js
const formatDuration = ms => {