refactor(frontend): switch from age to dob input and consume backend age
✅ Overview
This MR updates the frontend to replace the Age field with Date of Birth (DOB). Age calculation is handled entirely in the backend, and the frontend only consumes and displays the computed value.
✅ What does this MR do and why?
Previously, the frontend directly used and displayed the Age field. Now, the system is updated to:
- Accept DOB input instead of Age
- Send DOB to backend APIs
- Display calculated Age received from backend
✔ ️ Why this change?
- Age is dynamic and should not be handled in frontend
- Backend becomes the single source of truth
- Avoids inconsistent calculations across UI
✅ Changes Made
-
🔄 Replaced Age input field with DOB field in:- Forms (Profile / Patient / Registration)
-
🔗 Updated API integration:- Send
dobinstead ofagein request payload - Read
agefrom backend response (if provided)
- Send
-
🎯 UI Updates:- Added Date Picker for DOB selection
- Display age as read-only / computed value
-
🧹 Removed:
- Any frontend-based age calculation logic
- Age validation logic
✅ Technical Details
- Frontend no longer calculates age
- Backend handles age calculation and sends it in response
Data Flow:
- User enters DOB
- Frontend sends DOB → Backend
- Backend calculates age
- Frontend displays returned age
Screenshots
✅ Type of Change
-
🐛 Bug fix -
✨ New feature -
♻ ️ Refactor -
🎨 UI/UX improvement
✅ Testing Done
-
Manual testing completed
Test Cases
| Scenario | Expected Result | Status |
|---|---|---|
| Enter DOB | Value sent correctly to backend | |
| API response | Age received and displayed | |
| Edit DOB | Updated age shown from backend |
✅ Additional Notes
- Frontend strictly depends on backend for age calculation
- No duplicate logic maintained in UI
- Ensures consistency across the application
Edited by POORNA CHANDRA SAI TEJA KUMPATLA
