Initial frontend import
This commit is contained in:
18
src/utils/categoryDisplay.ts
Normal file
18
src/utils/categoryDisplay.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
/** Split display name into title + parenthetical subtitle (matches design cards). */
|
||||
export function categoryCardLines(
|
||||
name: string,
|
||||
description?: string,
|
||||
): { line1: string; line2?: string } {
|
||||
const i = name.indexOf("(");
|
||||
if (i > 0 && name.includes(")")) {
|
||||
return { line1: name.slice(0, i).trim(), line2: name.slice(i).trim() };
|
||||
}
|
||||
const j = name.indexOf("(");
|
||||
if (j > 0 && name.includes(")")) {
|
||||
return { line1: name.slice(0, j).trim(), line2: name.slice(j).trim() };
|
||||
}
|
||||
if (description?.trim()) {
|
||||
return { line1: name, line2: description.trim() };
|
||||
}
|
||||
return { line1: name };
|
||||
}
|
||||
7
src/utils/format.ts
Normal file
7
src/utils/format.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export function formatDateYmd(iso: string) {
|
||||
const d = new Date(iso);
|
||||
const y = d.getFullYear();
|
||||
const m = String(d.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(d.getDate()).padStart(2, "0");
|
||||
return `${y}-${m}-${day}`;
|
||||
}
|
||||
Reference in New Issue
Block a user