chore(repo): initialize planarchy workspace
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Format a date as dd/mm/yyyy for display in the UI.
|
||||
* Input date inputs (type="date") still use yyyy-mm-dd — this is for rendered text only.
|
||||
*/
|
||||
export function formatDate(d: Date | string | null | undefined): string {
|
||||
if (!d) return "";
|
||||
return new Date(d).toLocaleDateString("en-GB"); // en-GB → dd/mm/yyyy
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date as "DD MMM" (e.g. "04 Mar") for compact timeline labels.
|
||||
*/
|
||||
export function formatDateShort(d: Date | string): string {
|
||||
return new Date(d).toLocaleDateString("en-GB", { day: "2-digit", month: "short" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date as "MMM YY" (e.g. "Mar 26") for timeline month headers.
|
||||
*/
|
||||
export function formatMonthYear(d: Date | string): string {
|
||||
return new Date(d).toLocaleDateString("en-GB", { month: "short", year: "2-digit" });
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date in long form (e.g. "4 March 2026") for descriptive contexts.
|
||||
*/
|
||||
export function formatDateLong(d: Date | string): string {
|
||||
return new Date(d).toLocaleDateString("en-GB", { day: "numeric", month: "long", year: "numeric" });
|
||||
}
|
||||
Reference in New Issue
Block a user