(t?: Date | number | string)
| 151 | * If no date is provided, the current date is used. |
| 152 | */ |
| 153 | export function getNormalizedTimeString(t?: Date | number | string): string { |
| 154 | const date = new Date(t ? t : Date.now()); |
| 155 | |
| 156 | const yyyy = date.getFullYear(); |
| 157 | const M = date.getMonth() + 1; |
| 158 | const d = date.getDate(); |
| 159 | const h = date.getHours(); |
| 160 | const m = date.getMinutes(); |
| 161 | |
| 162 | const MM = M < 10 ? "0" + M : M; |
| 163 | const dd = d < 10 ? "0" + d : d; |
| 164 | const hh = h < 10 ? "0" + h : h; |
| 165 | const mm = m < 10 ? "0" + m : m; |
| 166 | |
| 167 | return `${yyyy}-${MM}-${dd}T${hh}:${mm}`; |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the provided date. |
no outgoing calls
no test coverage detected