const dateFormatter = new Intl.DateTimeFormat('en-GB', { day: 'numeric', month: 'short', year: 'numeric' }); export function formatDate(value: string): string { const date = new Date(value); return Number.isNaN(date.getTime()) ? '' : dateFormatter.format(date); } export function formatFileSize(bytes: number): string { if (bytes < 1024 * 1024) return `${Math.max(1, Math.round(bytes / 1024))} KB`; return `${(bytes / 1024 / 1024).toFixed(2)} MB`; } export const fileTypeLabel = (file: File) => (file.type.split('/').pop() ?? '').toUpperCase(); export function toFileName(value: string): string { return value.trim().replace(/\s+/g, '_'); }