-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Description:
The edit_task.go file in the Taskwarrior (tw) layer contains two critical issues that need to be addressed:
-
Double Date Formatting Produces Invalid Datetimes
The file appendsT00:00:00to all date strings, even when the controller has already converted ISO dates to Taskwarrior format. This results in invalid datetime strings like"2026-01-28T14:30:00T00:00:00", which Taskwarrior rejects. -
Redundant Annotation Block Execution
The conditionlen(annotations) >= 0is always true, causing the annotation regeneration block to execute unnecessarily, even when no annotations are provided. This leads to redundant operations, such as deleting and re-adding all existing annotations.
Steps to Reproduce:
-
For Double Date Formatting:
- Submit a request to edit a task with a
waitorduefield containing a full ISO datetime (e.g.,"2026-01-28T14:30:00"). - Observe that the resulting Taskwarrior command includes an invalid datetime string.
- Submit a request to edit a task with a
-
For Redundant Annotation Block Execution:
- Submit a request to edit a task without any annotations.
- Observe that the annotation regeneration block is executed, deleting and re-adding all existing annotations.
Expected Behavior:
-
Double Date Formatting:
- The
edit_task.gofile should only appendT00:00:00to date-only strings (e.g.,"2026-01-28") and leave full datetime strings unchanged.
- The
-
Annotation Block Execution:
- The annotation regeneration block should only execute when
len(annotations) > 0.
- The annotation regeneration block should only execute when
Actual Behavior:
-
Double Date Formatting:
- The
edit_task.gofile appendsT00:00:00to all date strings, resulting in invalid datetime strings.
- The
-
Annotation Block Execution:
- The annotation regeneration block executes regardless of whether annotations are provided, due to the
len(annotations) >= 0condition.
- The annotation regeneration block executes regardless of whether annotations are provided, due to the
Suggested Fix:
-
Double Date Formatting:
- Add a check in
edit_task.goto determine whether the input string is a date-only string or a full datetime string before appendingT00:00:00.
- Add a check in
-
Annotation Block Execution:
- Update the condition to
len(annotations) > 0to ensure the block only executes when annotations are provided.
- Update the condition to
File:
backend/utils/tw/edit_task.go
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context
Add any other context about the problem here.