diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/decent-homes/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/decent-homes/page.tsx index 125cb36..4354842 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/decent-homes/page.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/decent-homes/page.tsx @@ -237,7 +237,11 @@ function CriterionContent({ function ReplacementsContent({ items, }: { - items: { sub_variable: string; expiry_date: string | null }[]; + items: { + sub_variable: string; + expiry_date: string | null; + install_date: string | null; + }[]; }) { const today = new Date(); const groups: Record< @@ -245,6 +249,7 @@ function ReplacementsContent({ { sub_variable: string; expiry: Date; + install: Date; remaining: string; overdue: boolean; }[] @@ -256,8 +261,9 @@ function ReplacementsContent({ }; items.forEach((item) => { - if (!item.expiry_date) return; + if (!item.expiry_date || !item.install_date) return; const expiry = new Date(item.expiry_date); + const install = new Date(item.install_date); const diffMs = expiry.getTime() - today.getTime(); const diffMonths = diffMs / (1000 * 60 * 60 * 24 * 30); @@ -276,6 +282,7 @@ function ReplacementsContent({ const entry = { sub_variable: SUB_ITEMS_TEXT[item.sub_variable] ?? item.sub_variable, expiry, + install, remaining, overdue, }; @@ -351,9 +358,14 @@ function ReplacementsContent({