From 3015576d7e2bdb943ec3ec987068d49cd52103ef Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 12 Nov 2025 20:34:48 +0200 Subject: [PATCH] feat(board/promoted_attributes): format date & time --- .../attribute_widgets/PromotedAttributesDisplay.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx index 761a0bb3b..432ec4899 100644 --- a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx +++ b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx @@ -4,6 +4,7 @@ import "./PromotedAttributesDisplay.css"; import { useTriliumEvent } from "../react/hooks"; import attributes from "../../services/attributes"; import { DefinitionObject } from "../../services/promoted_attribute_definition_parser"; +import { formatDateTime } from "../../utils/formatters"; interface PromotedAttributesDisplayProps { note: FNote; @@ -57,6 +58,12 @@ function formatLabelValue(attr: AttributeWithDefinitions): string { } else { return numberValue.toString(); } + case "date": + case "datetime": + const date = new Date(value); + if (isNaN(date.getTime())) return value; + const timeFormat = attr.def.labelType === "datetime" ? "short" : "none"; + return formatDateTime(date, "short", timeFormat); case "text": default: return value;