(isoString)
| 258 | } |
| 259 | |
| 260 | function formatDate(isoString) { |
| 261 | const date = new Date(isoString); |
| 262 | const now = new Date(); |
| 263 | const diffMs = now - date; |
| 264 | const diffMins = Math.floor(diffMs / 60000); |
| 265 | const diffHours = Math.floor(diffMs / 3600000); |
| 266 | const diffDays = Math.floor(diffMs / 86400000); |
| 267 | |
| 268 | if (diffMins < 1) return 'Just now'; |
| 269 | if (diffMins < 60) return `${diffMins}m ago`; |
| 270 | if (diffHours < 24) return `${diffHours}h ago`; |
| 271 | if (diffDays < 7) return `${diffDays}d ago`; |
| 272 | |
| 273 | return date.toLocaleDateString(); |
| 274 | } |
| 275 | |
| 276 | function createHistoryDeleteButton(itemId) { |
| 277 | const btn = document.createElement('button'); |
no outgoing calls
no test coverage detected