(d?: Date | string | null, msSep?: string)
| 79 | export function logDate(d?: Date): string; |
| 80 | export function logDate(d?: Date | null, msSep?: string): string; |
| 81 | export function logDate(d?: Date | string | null, msSep?: string): string { |
| 82 | if (typeof d === 'string') { |
| 83 | // logDate(msSep) |
| 84 | msSep = d; |
| 85 | d = new Date(); |
| 86 | } else { |
| 87 | // logDate(d, msSep) |
| 88 | d = d || new Date(); |
| 89 | } |
| 90 | const [ year, month, date, hours, minutes, seconds ] = getDateStringParts(d); |
| 91 | const millisecondsNum = d.getMilliseconds(); |
| 92 | let milliseconds = `${millisecondsNum}`; |
| 93 | if (millisecondsNum < 10) { |
| 94 | milliseconds = `00${millisecondsNum}`; |
| 95 | } else if (millisecondsNum < 100) { |
| 96 | milliseconds = `0${millisecondsNum}`; |
| 97 | } |
| 98 | msSep = msSep || '.'; |
| 99 | return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}${msSep}${milliseconds}`; |
| 100 | } |
| 101 | |
| 102 | export const YYYYMMDDHHmmssSSS = logDate; |
| 103 |
no test coverage detected
searching dependent graphs…