Skip to content

High performance self-hosted photo and video management solution.

feat(web): display age in months when age is 0 (#5961)

jpsak09a7889e5e11a2
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}
<p
class="font-light"
@@ -277,7 +280,11 @@
{ locale: $locale },
)}
>
- Age {age}
+ {#if ageInMonths <= 11}
+ Age {ageInMonths} months
+ {:else}
+ Age {age}
+ {/if}
</p>
{/if}
{/if}