Add nextDueDate field to TaskResponse for recurring task support

- Add nextDueDate field to TaskResponse model (from API's next_due_date)
- Add effectiveDueDate computed property (nextDueDate ?? dueDate)
- Update DynamicTaskCard, TaskCard to display effectiveDueDate
- Update WidgetDataManager to save effectiveDueDate to widget cache
- Update TaskFormView to use effectiveDueDate when editing
- Fix preview mock data to include nextDueDate parameter

This ensures recurring tasks show the correct next due date after completion
instead of the original due date.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Trey t
2025-12-11 11:10:56 -06:00
parent cbe073aa21
commit 1839bd0e11
6 changed files with 15 additions and 8 deletions

View File

@@ -66,10 +66,10 @@ struct TaskFormView: View {
_selectedPriority = State(initialValue: task.priority)
_inProgress = State(initialValue: task.inProgress)
// Parse date from string
// Parse date from string - use effective due date (nextDueDate if set, otherwise dueDate)
let formatter = DateFormatter()
formatter.dateFormat = "yyyy-MM-dd"
_dueDate = State(initialValue: formatter.date(from: task.dueDate ?? "") ?? Date())
_dueDate = State(initialValue: formatter.date(from: task.effectiveDueDate ?? "") ?? Date())
_intervalDays = State(initialValue: "") // No longer in API
_estimatedCost = State(initialValue: task.estimatedCost != nil ? String(task.estimatedCost!.doubleValue) : "")