atom: avoid debug message when the date is empty

This commit is contained in:
Frédéric Guillot 2024-03-17 15:23:48 -07:00
parent b1e73fafdf
commit 8212f16aa2

View file

@ -106,6 +106,7 @@ func (a *Atom10Adapter) BuildFeed(baseURL string) *model.Feed {
// Populate the entry date. // Populate the entry date.
for _, value := range []string{atomEntry.Published, atomEntry.Updated} { for _, value := range []string{atomEntry.Published, atomEntry.Updated} {
if value != "" {
if parsedDate, err := date.Parse(value); err != nil { if parsedDate, err := date.Parse(value); err != nil {
slog.Debug("Unable to parse date from Atom 1.0 feed", slog.Debug("Unable to parse date from Atom 1.0 feed",
slog.String("date", value), slog.String("date", value),
@ -117,6 +118,7 @@ func (a *Atom10Adapter) BuildFeed(baseURL string) *model.Feed {
break break
} }
} }
}
if entry.Date.IsZero() { if entry.Date.IsZero() {
entry.Date = time.Now() entry.Date = time.Now()
} }