fix: Include start_date in goal edit form and API call
All checks were successful
Deploy Development / deploy (push) Successful in 51s
Build Test / lint-backend (push) Successful in 0s
Build Test / build-frontend (push) Successful in 14s

**Bug:** start_date was not being loaded into edit form or sent in update request

**Fixed:**
1. handleEditGoal() - Added start_date to formData when editing
2. handleSaveGoal() - Added start_date to API payload for both create and update

Now when editing a goal:
- start_date field is populated with existing value
- Changing start_date triggers backend to recalculate start_value
- Update request includes start_date

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lars 2026-03-28 13:19:10 +01:00
parent 327319115d
commit 1c7b5e0653

View File

@ -196,6 +196,7 @@ export default function GoalsPage() {
priority: goal.priority || 2, priority: goal.priority || 2,
target_value: goal.target_value, target_value: goal.target_value,
unit: goal.unit, unit: goal.unit,
start_date: goal.start_date || new Date().toISOString().split('T')[0],
target_date: goal.target_date || '', target_date: goal.target_date || '',
name: goal.name || '', name: goal.name || '',
description: goal.description || '', description: goal.description || '',
@ -227,6 +228,7 @@ export default function GoalsPage() {
priority: formData.priority, priority: formData.priority,
target_value: parseFloat(formData.target_value), target_value: parseFloat(formData.target_value),
unit: formData.unit, unit: formData.unit,
start_date: formData.start_date || null,
target_date: formData.target_date || null, target_date: formData.target_date || null,
name: formData.name || null, name: formData.name || null,
description: formData.description || null, description: formData.description || null,