From f794c3e0dfd9650410c6677b920230bcc056c9bc Mon Sep 17 00:00:00 2001 From: Yaros Date: Mon, 10 Mar 2025 15:47:44 +0100 Subject: [PATCH] feat(web): show birthdate on person page (#16772) * feat(web): show birthdate on person page * shorten null check Co-authored-by: Jason Rasmussen * directly use birthDate --------- Co-authored-by: Jason Rasmussen Co-authored-by: Alex --- i18n/en.json | 1 + .../[[assetId=id]]/+page.svelte | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 9b7ee261f2..5bd0f7d371 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -987,6 +987,7 @@ "permanently_deleted_asset": "Permanently deleted asset", "permanently_deleted_assets_count": "Permanently deleted {count, plural, one {# asset} other {# assets}}", "person": "Person", + "person_birthdate": "Born on {date}", "person_hidden": "{name}{hidden, select, true { (hidden)} other {}}", "photo_shared_all_users": "Looks like you shared your photos with all users or you don't have any user to share with.", "photos": "Photos", diff --git a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte index b591cf1bdb..6cad217377 100644 --- a/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/people/[personId]/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -62,6 +62,8 @@ import { onDestroy, onMount } from 'svelte'; import { t } from 'svelte-i18n'; import type { PageData } from './$types'; + import { locale } from '$lib/stores/preferences.store'; + import { DateTime } from 'luxon'; interface Props { data: PageData; @@ -539,12 +541,28 @@ heightStyle="3.375rem" />

{person.name || $t('add_a_name')}

-

+

{$t('assets_count', { values: { count: numberOfAssets } })}

+ {#if person.birthDate} +

+ {$t('person_birthdate', { + values: { + date: DateTime.fromISO(person.birthDate).toLocaleString( + { + month: 'numeric', + day: 'numeric', + year: 'numeric', + }, + { locale: $locale }, + ), + }, + })} +

+ {/if}