Default date to now

This commit is contained in:
2024-11-04 16:08:54 +01:00
parent 663fb3424e
commit ca804ab425

View File

@@ -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 {