Default date to now
This commit is contained in:
@@ -40,6 +40,7 @@ func BuildWhereQuery(params interface{}) string {
|
||||
}
|
||||
|
||||
var associationRe = regexp.MustCompile(`r:(\w+)(?:\(([^)]+)\))?`)
|
||||
|
||||
func ParseNote(data string) (NoteData, error) {
|
||||
log.Printf("Parsing note: %q", data)
|
||||
res := NoteData{}
|
||||
@@ -67,6 +68,9 @@ func ParseNote(data string) (NoteData, error) {
|
||||
}
|
||||
}
|
||||
res.Note = strings.Join(note, "\n")
|
||||
if res.Date.IsZero() {
|
||||
res.Date = time.Now()
|
||||
}
|
||||
|
||||
matches := associationRe.FindAllStringSubmatch(res.Note, -1)
|
||||
for _, match := range matches {
|
||||
@@ -119,4 +123,4 @@ func PersistNoteData(note NoteData) (Note, []Association, error) {
|
||||
}
|
||||
|
||||
return res, ass, nil
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user