(isoString: string, format: string)
| 68 | * @returns The formatted date string or null if invalid |
| 69 | */ |
| 70 | export function formatISODate(isoString: string, format: string): string | null { |
| 71 | if (!window.moment) { |
| 72 | return null; |
| 73 | } |
| 74 | |
| 75 | try { |
| 76 | const moment = window.moment(isoString); |
| 77 | if (moment.isValid()) { |
| 78 | return moment.format(format); |
| 79 | } |
| 80 | } catch { |
| 81 | // Invalid date - return null |
| 82 | } |
| 83 | |
| 84 | return null; |
| 85 | } |
no test coverage detected