mirror of
https://github.com/immich-app/immich.git
synced 2025-03-11 02:23:09 -05:00
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
This commit is contained in:
parent
dea1063b17
commit
a7889e5e11
1 changed files with 8 additions and 1 deletions
|
@ -265,6 +265,9 @@
|
||||||
{#if person.birthDate}
|
{#if person.birthDate}
|
||||||
{@const personBirthDate = DateTime.fromISO(person.birthDate)}
|
{@const personBirthDate = DateTime.fromISO(person.birthDate)}
|
||||||
{@const age = Math.floor(DateTime.fromISO(asset.fileCreatedAt).diff(personBirthDate, 'years').years)}
|
{@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}
|
{#if age >= 0}
|
||||||
<p
|
<p
|
||||||
class="font-light"
|
class="font-light"
|
||||||
|
@ -277,7 +280,11 @@
|
||||||
{ locale: $locale },
|
{ locale: $locale },
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
Age {age}
|
{#if ageInMonths <= 11}
|
||||||
|
Age {ageInMonths} months
|
||||||
|
{:else}
|
||||||
|
Age {age}
|
||||||
|
{/if}
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Add table
Reference in a new issue