(date = new Date())
| 45 | } |
| 46 | |
| 47 | function formatFixedDate(date = new Date()) { |
| 48 | const dd = String(date.getDate()).padStart(2, "0"); |
| 49 | const months = [ |
| 50 | "Jan", |
| 51 | "Feb", |
| 52 | "Mar", |
| 53 | "Apr", |
| 54 | "May", |
| 55 | "Jun", |
| 56 | "Jul", |
| 57 | "Aug", |
| 58 | "Sep", |
| 59 | "Oct", |
| 60 | "Nov", |
| 61 | "Dec" |
| 62 | ]; |
| 63 | const mmm = months[date.getMonth()]; |
| 64 | const yyyy = String(date.getFullYear()); |
| 65 | let h = date.getHours(); |
| 66 | const ampm = h >= 12 ? "PM" : "AM"; |
| 67 | h = h % 12; |
| 68 | if (h === 0) h = 12; |
| 69 | const HH12 = String(h).padStart(2, "0"); |
| 70 | const MM = String(date.getMinutes()).padStart(2, "0"); |
| 71 | return `${dd}-${mmm}-${yyyy} ${HH12}:${MM} ${ampm}`; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Remove characters not allowed in file names for major OSes. |
no outgoing calls
no test coverage detected