task: format time correctly for taskNotes

This commit is contained in:
Anish Lakhwara 2024-05-25 03:22:17 -07:00
parent d2ce0cc991
commit a8babd5e99

View file

@ -88,16 +88,16 @@ func RowsToFile(taskList []table.Row, activeIndex int) []string {
} }
func CreateTaskNote(note_path string, row table.Row) { func CreateTaskNote(note_path string, row table.Row) {
t := time.Now()
f, err := os.Create(note_path) f, err := os.Create(note_path)
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
path := time.Now().Format(time.DateOnly)
tags := strings.Replace(row[2], " ", ":", -1) tags := strings.Replace(row[2], " ", ":", -1)
tags = ":" + row[1] + ":" + tags + ":" tags = ":" + row[1] + ":" + tags + ":"
fmt.Fprintln(f, "%title "+row[3]) fmt.Fprintln(f, "%title "+row[3])
fmt.Fprintln(f, tags) fmt.Fprintln(f, tags)
fmt.Fprintln(f, "%date "+path) fmt.Fprintln(f, "%date "+t.Format("2006-01-02 15:06"))
fmt.Fprintln(f, "") fmt.Fprintln(f, "")
defer f.Close() defer f.Close()
} }