From a7889e5e11a23ac260396688a2096489cdc5c1e1 Mon Sep 17 00:00:00 2001 From: jpsak09 Date: Mon, 25 Dec 2023 10:38:14 -0600 Subject: [PATCH] feat(web): display age in months when age is 0 (#5961) * display age in months when age is 0 * simplifying conditionals, using full word "month" over abbreviation --- web/src/lib/components/asset-viewer/detail-panel.svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index 0ceafa37c0..48faadcd07 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -265,6 +265,9 @@ {#if person.birthDate} {@const personBirthDate = DateTime.fromISO(person.birthDate)} {@const age = Math.floor(DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'years').years)} + {@const ageInMonths = Math.floor( + DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'months').months, + )} {#if age >= 0}

- Age {age} + {#if ageInMonths <= 11} + Age {ageInMonths} months + {:else} + Age {age} + {/if}

{/if} {/if}