Guidelines fix

This commit is contained in:
Michael Goldspinner
2018-01-12 10:05:03 -05:00
parent 49ddcb5e63
commit 1ca07eb961
8 changed files with 55 additions and 55 deletions

13
snippets/getColonTime.md Normal file
View File

@ -0,0 +1,13 @@
### toColonTime
Returns transformed time integers from provided date object to "colon time" representation. Formats hour to 12 hour and maintains digit length of colon time format (HH:MM:SS).
```js
let toColonTime = ( date ) => {
let times = [ date.getHours(), date.getMinutes(), date.getSeconds() ];
times[0] = times[0] === 0 || times[0] === 12 || times[0] === 24 ? 12 : times[0] % 12;
return times.map( time => time.toString().padStart(2, "0") ).join(":");
}
// toColonTime12(new Date()) -> "08:38:00"
```