fix(profile): persist & expose birthday as a single Unix field

Birthday was never saved (hydrate forced null) and not returned in a form the
clients use. Now:
- hydrate stores the incoming `birthday` (Unix) into date_of_birth; `birthday`
  takes priority over a stray `date_of_birth: null` in the same payload so it
  can't be wiped.
- toArray exposes a single `birthday` (Unix) key — drop the duplicate
  `date_of_birth` output to avoid overlap.
- admin UserDetailPage reads profile.birthday (formatDate renders Jalali).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-06-16 11:42:31 +03:30
co-authored by Claude Opus 4.8
parent 800f9ad8cd
commit b60dbdadba
4 changed files with 90 additions and 9 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ interface UserProfileData {
uuid: string;
national_code: string | null;
gender: string | null;
date_of_birth: number | null;
birthday: number | null;
blood_type: string | null;
marital_status: string | null;
education: string | null;
@@ -539,7 +539,7 @@ export default function UserDetailPage() {
<InfoCard icon={UserIcon} label="نام پدر" value={profile.fathers_name} />
<InfoCard icon={ClipboardDocumentIcon} label="کد ملی" value={profile.national_code} mono copyable />
<InfoCard icon={UserIcon} label="جنسیت" value={profile.gender ? GENDER_LABELS[profile.gender] ?? profile.gender : null} />
<InfoCard icon={CalendarIcon} label="تاریخ تولد" value={profile.date_of_birth ? formatDate(profile.date_of_birth as any) : null} />
<InfoCard icon={CalendarIcon} label="تاریخ تولد" value={profile.birthday ? formatDate(profile.birthday) : null} />
<InfoCard icon={UserIcon} label="گروه خونی" value={profile.blood_type} />
<InfoCard icon={UserIcon} label="وضعیت تأهل" value={profile.marital_status ? MARITAL_LABELS[profile.marital_status] ?? profile.marital_status : null} />
<InfoCard icon={UserIcon} label="تحصیلات" value={profile.education} />