diff --git a/frontend/icons/alert-circle.svg b/frontend/icons/alert-circle.svg new file mode 100644 index 0000000..8d02b7d --- /dev/null +++ b/frontend/icons/alert-circle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/icons/alert-triangle.svg b/frontend/icons/alert-triangle.svg new file mode 100644 index 0000000..6dcb096 --- /dev/null +++ b/frontend/icons/alert-triangle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/icons/chevron-down.svg b/frontend/icons/chevron-down.svg new file mode 100644 index 0000000..278c6a3 --- /dev/null +++ b/frontend/icons/chevron-down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/icons/chevron-up.svg b/frontend/icons/chevron-up.svg new file mode 100644 index 0000000..4eb5ecc --- /dev/null +++ b/frontend/icons/chevron-up.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/icons/trash-2.svg b/frontend/icons/trash-2.svg new file mode 100644 index 0000000..f24d55b --- /dev/null +++ b/frontend/icons/trash-2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/src/lib/format.ts b/frontend/src/lib/format.ts new file mode 100644 index 0000000..0b67a43 --- /dev/null +++ b/frontend/src/lib/format.ts @@ -0,0 +1,20 @@ +// Format a YYYY-MM-DD (or ISO) string as DDMMYY for user-facing dates. +export function formatDDMMYY(dateStr: string | undefined): string { + if (!dateStr) return ''; + const d = new Date(dateStr.slice(0, 10) + 'T00:00:00'); + const day = String(d.getDate()).padStart(2, '0'); + const mon = String(d.getMonth() + 1).padStart(2, '0'); + const yr = String(d.getFullYear()).slice(2); + return `${day}${mon}${yr}`; +} + +// Human-friendly date for due dates etc: "5 Aug" (adds year when not the +// current one, e.g. "5 Aug 26"). Better than the compact DDMMYY code. +export function formatShortDate(dateStr: string | undefined): string { + if (!dateStr) return ''; + const d = new Date(dateStr.slice(0, 10) + 'T00:00:00'); + if (Number.isNaN(d.getTime())) return ''; + const mon = d.toLocaleDateString('en-GB', { month: 'short' }); + const sameYear = d.getFullYear() === new Date().getFullYear(); + return `${d.getDate()} ${mon}${sameYear ? '' : ' ' + String(d.getFullYear()).slice(2)}`; +}