(dateStr)
| 8686 | } |
| 8687 | |
| 8688 | function parseCustomDate(dateStr) { |
| 8689 | dateStr = dateStr.replace(/\s+/g, " ").trim(); |
| 8690 | const parts = dateStr.split(" "); |
| 8691 | if (parts.length !== 2) { |
| 8692 | return new Date(dateStr).getTime(); |
| 8693 | } |
| 8694 | const datePart = parts[0]; |
| 8695 | const timePart = parts[1]; |
| 8696 | const dateComponents = datePart.split("/"); |
| 8697 | if (dateComponents.length !== 3) { |
| 8698 | return new Date(dateStr).getTime(); |
| 8699 | } |
| 8700 | let month = parseInt(dateComponents[0], 10); |
| 8701 | let day = parseInt(dateComponents[1], 10); |
| 8702 | let year = parseInt(dateComponents[2], 10); |
| 8703 | if (year < 100) { |
| 8704 | year += 2000; |
| 8705 | } |
| 8706 | const timeRegex = /^(\d{1,2}):(\d{2})(AM|PM)$/i; |
| 8707 | const match = timePart.match(timeRegex); |
| 8708 | if (!match) { |
| 8709 | return new Date(dateStr).getTime(); |
| 8710 | } |
| 8711 | let hour = parseInt(match[1], 10); |
| 8712 | const minute = parseInt(match[2], 10); |
| 8713 | const period = match[3].toUpperCase(); |
| 8714 | if (period === "PM" && hour !== 12) { |
| 8715 | hour += 12; |
| 8716 | } |
| 8717 | if (period === "AM" && hour === 12) { |
| 8718 | hour = 0; |
| 8719 | } |
| 8720 | return new Date(year, month - 1, day, hour, minute).getTime(); |
| 8721 | } |
| 8722 | |
| 8723 | export function canEditFile(fileName) { |
| 8724 | if (!fileName || typeof fileName !== "string") return false; |
no test coverage detected