From 00874840b731dc58a98632afaf5b93cb22fd9f10 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 12 Nov 2025 20:48:45 +0200 Subject: [PATCH] feat(board/promoted_attributes): format time --- .../attribute_widgets/PromotedAttributesDisplay.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx index 0d0b1c534..7552c3520 100644 --- a/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx +++ b/apps/client/src/widgets/attribute_widgets/PromotedAttributesDisplay.tsx @@ -61,11 +61,15 @@ function formatLabelValue(attr: AttributeWithDefinitions): ComponentChildren { } return <>{attr.friendlyName}: {formattedValue}; case "date": - case "datetime": + case "datetime": { const date = new Date(value); - if (isNaN(date.getTime())) return value; - const timeFormat = attr.def.labelType === "datetime" ? "short" : "none"; + const timeFormat = attr.def.labelType !== "date" ? "short" : "none"; return <>{attr.friendlyName}: {formatDateTime(date, "short", timeFormat)}; + } + case "time": { + const date = new Date(`1970-01-01T${value}Z`); + return <>{attr.friendlyName}: {formatDateTime(date, "none", "short")}; + } case "boolean": return <> {attr.friendlyName}; case "text": @@ -81,7 +85,7 @@ function getAttributesWithDefinitions(note: FNote, attributesToIgnore: string[] const def = attr.getDefinition(); const [ type, name ] = attr.name.split(":", 2); const value = note.getLabelValue(name); - const friendlyName = def?.promotedAlias ?? name; + const friendlyName = def?.promotedAlias || name; if (!value) continue; if (attributesToIgnore.includes(name)) continue;