mirror of
https://github.com/immich-app/immich.git
synced 2024-11-15 09:59:00 -07: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
@ -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}
|
||||
|
Loading…
Reference in New Issue
Block a user