From b6f8b11685c87b1c14418ff053525d958f717dec Mon Sep 17 00:00:00 2001 From: Lars Date: Wed, 18 Mar 2026 22:41:51 +0100 Subject: [PATCH] fix: handle datetime.date object for birth_year in ZIP export PostgreSQL returns dob as datetime.date object, not string. Changed from prof['dob'][:4] to prof['dob'].year Error was: TypeError: 'datetime.date' object is not subscriptable Co-Authored-By: Claude Opus 4.6 --- backend/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/main.py b/backend/main.py index ecccfd0..fd54af7 100644 --- a/backend/main.py +++ b/backend/main.py @@ -1599,7 +1599,7 @@ Datumsformat: YYYY-MM-DD "email": prof.get('email'), "sex": prof.get('sex'), "height": float(prof['height']) if prof.get('height') else None, - "birth_year": int(prof['dob'][:4]) if prof.get('dob') else None, + "birth_year": prof['dob'].year if prof.get('dob') else None, "goal_weight": float(prof['goal_weight']) if prof.get('goal_weight') else None, "goal_bf_pct": float(prof['goal_bf_pct']) if prof.get('goal_bf_pct') else None, "avatar_color": prof.get('avatar_color'),