Fix date parsing for Checkvist API format

Add custom APITime type with UnmarshalJSON to handle the non-standard
date format returned by the Checkvist API ("2026/01/14 16:07:31 +0000")
instead of the expected RFC3339 format.

Changes:
- Add APITime type with custom JSON marshaling/unmarshaling in models.go
- Replace time.Time with APITime for UpdatedAt/CreatedAt fields in
  Checklist, Task, and Note structs
- Add NewAPITime constructor for convenience
- Update test fixtures to use real API date format
- Add comprehensive unit tests for APITime in models_test.go

Fixes: checkvist-api-4qn
This commit is contained in:
Oliver Jakoubek 2026-01-14 18:10:02 +01:00
commit e4862b8e9b
12 changed files with 241 additions and 30 deletions

View file

@ -8,7 +8,7 @@
"task_count": 10,
"task_completed": 3,
"tags_as_text": "",
"updated_at": "2026-01-14T10:00:00Z"
"updated_at": "2026/01/14 10:00:00 +0000"
},
{
"id": 2,
@ -19,6 +19,6 @@
"task_count": 25,
"task_completed": 12,
"tags_as_text": "work, important",
"updated_at": "2026-01-13T15:30:00Z"
"updated_at": "2026/01/13 15:30:00 +0000"
}
]

View file

@ -8,6 +8,6 @@
"task_count": 50,
"task_completed": 50,
"tags_as_text": "",
"updated_at": "2025-06-01T09:00:00Z"
"updated_at": "2025/06/01 09:00:00 +0000"
}
]

View file

@ -7,5 +7,5 @@
"task_count": 10,
"task_completed": 3,
"tags_as_text": "",
"updated_at": "2026-01-14T10:00:00Z"
"updated_at": "2026/01/14 10:00:00 +0000"
}

View file

@ -3,14 +3,14 @@
"id": 501,
"task_id": 101,
"comment": "First comment on task",
"updated_at": "2026-01-14T10:00:00Z",
"created_at": "2026-01-13T09:00:00Z"
"updated_at": "2026/01/14 10:00:00 +0000",
"created_at": "2026/01/13 09:00:00 +0000"
},
{
"id": 502,
"task_id": 101,
"comment": "Second comment with more details",
"updated_at": "2026-01-14T11:30:00Z",
"created_at": "2026-01-14T11:00:00Z"
"updated_at": "2026/01/14 11:30:00 +0000",
"created_at": "2026/01/14 11:00:00 +0000"
}
]

View file

@ -12,8 +12,8 @@
"assignee_ids": [],
"comments_count": 0,
"update_line": "",
"updated_at": "2026-01-14T10:00:00Z",
"created_at": "2026-01-10T09:00:00Z"
"updated_at": "2026/01/14 10:00:00 +0000",
"created_at": "2026/01/10 09:00:00 +0000"
},
{
"id": 102,
@ -28,7 +28,7 @@
"assignee_ids": [1, 2],
"comments_count": 3,
"update_line": "",
"updated_at": "2026-01-14T11:00:00Z",
"created_at": "2026-01-11T10:00:00Z"
"updated_at": "2026/01/14 11:00:00 +0000",
"created_at": "2026/01/11 10:00:00 +0000"
}
]

View file

@ -11,6 +11,6 @@
"assignee_ids": [],
"comments_count": 0,
"update_line": "",
"updated_at": "2026-01-14T10:00:00Z",
"created_at": "2026-01-10T09:00:00Z"
"updated_at": "2026/01/14 10:00:00 +0000",
"created_at": "2026/01/10 09:00:00 +0000"
}