Skip to content

Commit 2ffc61a

Browse files
inderjeet20Inderjeet Singh
andauthored
fix(tw): fix double date formatting and annotation condition in edit_task.go (#465)
- Only append T00:00:00 to wait/due fields when the value is a date-only string (no existing 'T'). Full ISO datetimes already formatted by the controller were being corrupted to e.g. '2026-01-28T14:30:00T00:00:00'. - Change len(annotations) >= 0 to len(annotations) > 0. The previous condition was always true, causing the export/denotate/re-annotate block to run on every edit even when no annotations were provided, silently destroying and re-creating all existing task annotations unnecessarily. Co-authored-by: Inderjeet Singh <inderjet05@gmail.com>
1 parent ddf5ba0 commit 2ffc61a

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

backend/utils/tw/edit_task.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ func EditTaskInTaskwarrior(
4040
}
4141

4242
if wait != "" {
43-
formattedWait := wait + "T00:00:00"
43+
formattedWait := wait
44+
if !strings.Contains(wait, "T") {
45+
formattedWait = wait + "T00:00:00"
46+
}
4447
modifyArgs = append(modifyArgs, "wait:"+formattedWait)
4548
}
4649

@@ -60,7 +63,10 @@ func EditTaskInTaskwarrior(
6063
modifyArgs = append(modifyArgs, "depends:"+dependsStr)
6164

6265
if due != "" {
63-
formattedDue := due + "T00:00:00"
66+
formattedDue := due
67+
if !strings.Contains(due, "T") {
68+
formattedDue = due + "T00:00:00"
69+
}
6470
modifyArgs = append(modifyArgs, "due:"+formattedDue)
6571
}
6672

@@ -82,7 +88,7 @@ func EditTaskInTaskwarrior(
8288
return fmt.Errorf("failed to edit task: %v", err)
8389
}
8490

85-
if len(annotations) >= 0 {
91+
if len(annotations) > 0 {
8692
output, err := utils.ExecCommandForOutputInDir(tempDir, "task", taskUUID, "export")
8793
if err == nil {
8894
var tasks []map[string]interface{}

0 commit comments

Comments
 (0)