(date: Date, fmt = '%Y-%m-%d %H:%M:%S')
| 60 | } |
| 61 | |
| 62 | export function formatDate(date: Date, fmt = '%Y-%m-%d %H:%M:%S') { |
| 63 | let m = (date.getMonth() + 1).toString(); |
| 64 | if (m.length < 2) m = `0${m}`; |
| 65 | let d = date.getDate().toString(); |
| 66 | if (d.length < 2) d = `0${d}`; |
| 67 | let H = date.getHours().toString(); |
| 68 | if (H.length < 2) H = `0${H}`; |
| 69 | let M = date.getMinutes().toString(); |
| 70 | if (M.length < 2) M = `0${M}`; |
| 71 | let S = date.getSeconds().toString(); |
| 72 | if (S.length < 2) S = `0${S}`; |
| 73 | return fmt |
| 74 | .replace('%Y', date.getFullYear().toString()) |
| 75 | .replace('%m', m) |
| 76 | .replace('%d', d) |
| 77 | .replace('%H', H) |
| 78 | .replace('%M', M) |
| 79 | .replace('%S', S); |
| 80 | } |
| 81 | |
| 82 | Math.sum = function sum(...args) { |
| 83 | let s = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected