(dateStr: string)
| 178 | } |
| 179 | |
| 180 | export function formatDateShort(dateStr: string): string { |
| 181 | const hasTime = dateStr.includes('T') |
| 182 | const [datePart, timePart] = dateStr.split('T') |
| 183 | const [, month, day] = datePart.split('-').map(Number) |
| 184 | const months = [ |
| 185 | 'Jan', |
| 186 | 'Feb', |
| 187 | 'Mar', |
| 188 | 'Apr', |
| 189 | 'May', |
| 190 | 'Jun', |
| 191 | 'Jul', |
| 192 | 'Aug', |
| 193 | 'Sep', |
| 194 | 'Oct', |
| 195 | 'Nov', |
| 196 | 'Dec', |
| 197 | ] |
| 198 | const dateLabel = `${months[month - 1]} ${day}` |
| 199 | if (hasTime && timePart) { |
| 200 | return `${dateLabel} ${timePart.slice(0, 5)}` |
| 201 | } |
| 202 | return dateLabel |
| 203 | } |
| 204 | |
| 205 | export const formatDate = (dateString: string) => { |
| 206 | const date = new Date(dateString) |
no outgoing calls
no test coverage detected