Fix table formatting

This commit is contained in:
Martin
2024-05-25 00:28:34 +02:00
parent f7b54b607b
commit 5d930685a3
8 changed files with 235 additions and 249 deletions

View File

@ -9,6 +9,10 @@ import (
"time"
)
const (
dtformat = "20060102T150405Z"
)
type Annotation struct {
Entry string `json:"entry,omitempty"`
Description string `json:"description,omitempty"`
@ -184,6 +188,15 @@ func (t *Task) GetString(fieldWFormat string) string {
}
}
func (t *Task) GetDate(dateString string) time.Time {
dt, err := time.Parse(dtformat, dateString)
if err != nil {
slog.Error("Failed to parse time:", err)
return time.Time{}
}
return dt
}
type Tasks []*Task
type Context struct {
@ -212,7 +225,6 @@ func formatDate(date string, format string) string {
return ""
}
dtformat := "20060102T150405Z"
dt, err := time.Parse(dtformat, date)
if err != nil {
slog.Error("Failed to parse time:", err)