diff --git a/cista-front/src/utils/index.ts b/cista-front/src/utils/index.ts index dd0bb36..384eb27 100644 --- a/cista-front/src/utils/index.ts +++ b/cista-front/src/utils/index.ts @@ -42,13 +42,14 @@ export function formatUnixDate(t: number) { return formatter.format(Math.round(diff / 86400000), 'day') } - let d = date.toLocaleDateString(undefined, { + let d = date.toLocaleDateString('en-ie', { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric' - }).replace("Sept", "Sep").replaceAll(',', '') - d = (d.length === 15 ? d : d.replace(' ', ' \u2007')).replaceAll(' ', '\u202F').replace('\u202F', '\u00A0') + }).replace("Sept", "Sep") + if (d.length === 14) d = d.replace(' ', '\u202F\u2007') // dom < 10 alignment (thin and figure spaces) + d = d.replaceAll(' ', '\u202F').replace('\u202F', '\u00A0') // nobr spaces, thin w/ date but not weekday d = d.slice(0, -4) + d.slice(-2) // Two digit year is enough return d }