diff options
| author | William Hergès <william@herges.fr> | 2025-10-29 21:44:38 +0100 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-10-29 21:44:38 +0100 |
| commit | a221da8d306d805a60dde6c231d49ac8019fa8dc (patch) | |
| tree | 0997185c5844e8dadb82f394e99ee7f41feca1d3 | |
| parent | f582b92e2b8e2a301380e420794e71200f0dbdfa (diff) | |
feat(rss): more precise hour for new content
| -rw-r--r-- | backend/section.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/backend/section.go b/backend/section.go index 0e31613..1333f87 100644 --- a/backend/section.go +++ b/backend/section.go @@ -20,6 +20,7 @@ import ( var ( sections = map[string]map[string]*sectionData{} + now = time.Now() ) type Section struct { @@ -50,7 +51,12 @@ func (d *sectionData) PubDate() string { } func (d *sectionData) PubDateRSS() string { - return d.PubLocalDate.AsTime(time.Local).Format(time.RFC1123Z) // because RFC822 in go isn't RFC822??? + t := d.PubLocalDate.AsTime(time.Local) + // if same day, assume that it's published now + if t.Year() == now.Year() && t.Month() == now.Month() && t.Day() == now.Day() { + t = now + } + return t.Format(time.RFC1123Z) // because RFC822 in go isn't RFC822??? } func (d *sectionData) Title() string { |
