accept loop param on task
This commit is contained in:
@@ -23,6 +23,7 @@ type Task struct {
|
||||
Complete bool
|
||||
Note []string
|
||||
Due time.Time
|
||||
Loop time.Duration
|
||||
|
||||
Index int
|
||||
}
|
||||
@@ -42,8 +43,8 @@ func New(r *http.Request) (*Task, error) {
|
||||
Tags: append(StrList(form.ToStrArr(form.Get(r, "tag"))), StrList(form.ToStrArr(form.Get(r, "tags")))...),
|
||||
Created: time.Now(),
|
||||
Edited: time.Now(),
|
||||
|
||||
Due: form.ToTime(form.Get(r, "duedate")),
|
||||
Due: form.ToTime(form.Get(r, "duedate")),
|
||||
Loop: form.ToDuration(form.Get(r, "loop")),
|
||||
}
|
||||
task.SetNote(form.Get(r, "note"))
|
||||
return task, task.validate()
|
||||
@@ -73,7 +74,8 @@ func (t *Task) MarshalJSON() ([]byte, error) {
|
||||
// "dueClass":"",
|
||||
// "dueStr":"",
|
||||
// "dueInt":33330000,
|
||||
// "dueTitle":"Due "}
|
||||
// "dueTitle":"Due ",
|
||||
// "loop": "1m"}
|
||||
// ]}
|
||||
fullFormat := "02 Jan 2006 03:04 PM"
|
||||
shortFormat := "02 Jan"
|
||||
@@ -109,6 +111,7 @@ func (t *Task) MarshalJSON() ([]byte, error) {
|
||||
"dueStr": t.Due.Format(shortFormat),
|
||||
"dueInt": t.Due.Unix(),
|
||||
"dueTitle": "Due ",
|
||||
"loop": t.Loop.String(),
|
||||
}
|
||||
if t.Due.IsZero() {
|
||||
for k := range m {
|
||||
|
||||
Reference in New Issue
Block a user