fix tags and duedates
This commit is contained in:
@@ -39,7 +39,7 @@ func New(r *http.Request) (*Task, error) {
|
||||
UUID: form.NewUUID(),
|
||||
Title: form.Get(r, "title"),
|
||||
Priority: form.ToInt(form.Get(r, "prio")),
|
||||
Tags: StrList(form.ToStrArr(form.Get(r, "tags"))),
|
||||
Tags: append(StrList(form.ToStrArr(form.Get(r, "tag"))), StrList(form.ToStrArr(form.Get(r, "tags")))...),
|
||||
Created: time.Now(),
|
||||
Edited: time.Now(),
|
||||
|
||||
@@ -110,6 +110,13 @@ func (t *Task) MarshalJSON() ([]byte, error) {
|
||||
"dueInt": t.Due.Unix(),
|
||||
"dueTitle": "Due ",
|
||||
}
|
||||
if t.Due.IsZero() {
|
||||
for k := range m {
|
||||
if strings.HasPrefix(k, "due") {
|
||||
delete(m, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
if t.Complete {
|
||||
m["dateCompleted"] = t.Completed.Format(fullFormat)
|
||||
m["dateCompletedInline"] = t.Completed.Format(shortFormat)
|
||||
|
||||
Reference in New Issue
Block a user