(milliseconds)
| 184 | |
| 185 | // https://stackoverflow.com/a/8212878 |
| 186 | function millisecondsToStr(milliseconds) { |
| 187 | function numberEnding(number) { |
| 188 | return number > 1 ? "s" : "" |
| 189 | } |
| 190 | |
| 191 | let temp = Math.floor(milliseconds / 1000) |
| 192 | let hours = Math.floor((temp %= 86400) / 3600) |
| 193 | let s = "" |
| 194 | if (hours) { |
| 195 | s += hours + " hour" + numberEnding(hours) + " " |
| 196 | } |
| 197 | let minutes = Math.floor((temp %= 3600) / 60) |
| 198 | if (minutes) { |
| 199 | s += minutes + " minute" + numberEnding(minutes) + " " |
| 200 | } |
| 201 | let seconds = temp % 60 |
| 202 | if (!hours && minutes < 4 && seconds) { |
| 203 | s += seconds + " second" + numberEnding(seconds) |
| 204 | } |
| 205 | |
| 206 | return s |
| 207 | } |
| 208 | |
| 209 | // https://rosettacode.org/wiki/Brace_expansion#JavaScript |
| 210 | function BraceExpander() { |
no test coverage detected