aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/item.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/feed/item.go')
-rw-r--r--internal/feed/item.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/feed/item.go b/internal/feed/item.go
index bbf7668..8b747fb 100644
--- a/internal/feed/item.go
+++ b/internal/feed/item.go
@@ -3,6 +3,7 @@ package feed
import (
"encoding/base64"
"fmt"
+ "time"
"github.com/google/uuid"
"github.com/mmcdole/gofeed"
@@ -27,6 +28,20 @@ type item struct {
itemId uuid.UUID
}
+func (item *item) DateParsed() *time.Time {
+ if item.UpdatedParsed == nil || item.UpdatedParsed.IsZero() {
+ return item.PublishedParsed
+ }
+ return item.UpdatedParsed
+}
+
+func (item *item) Date() string {
+ if item.Updated == "" {
+ return item.Published
+ }
+ return item.Updated
+}
+
// Creator returns the name of the creating author.
func (item *item) Creator() string {
if item.Author != nil {