diff --git a/projects/task.go b/projects/task.go index 43b1520..21ec6f8 100644 --- a/projects/task.go +++ b/projects/task.go @@ -76,11 +76,11 @@ type Task struct { // Progress is the progress of the task, in percentage (0-100). Progress int64 `json:"progress"` - // StartAt is the date and time when the task is scheduled to start. - StartAt *time.Time `json:"startDate"` + // StartAt is the date when the task is scheduled to start. + StartAt *twapi.Date `json:"startDate"` - // DueAt is the date and time when the task is scheduled to be completed. - DueAt *time.Time `json:"dueDate"` + // DueAt is the date when the task is scheduled to be completed. + DueAt *twapi.Date `json:"dueDate"` // EstimatedMinutes is the estimated time to complete the task, in minutes. EstimatedMinutes int64 `json:"estimateMinutes"` diff --git a/types.go b/types.go index d6ecb9c..95c4d14 100644 --- a/types.go +++ b/types.go @@ -8,6 +8,7 @@ import ( "net/http" "regexp" "strconv" + "strings" "time" ) @@ -80,6 +81,9 @@ func (d *Date) UnmarshalJSON(data []byte) error { if err := json.Unmarshal(data, &str); err != nil { return err } + if strings.Contains(str, "T") { + str, _, _ = strings.Cut(str, "T") + } parsedTime, err := time.Parse("2006-01-02", str) if err != nil { return err