fix(redisset): parse Published date without colon as well
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Some feeds include a timezone without a colon ":". This changes makes it so this is parsed as well.
This commit is contained in:
parent
9df63af33c
commit
2f0758748d
|
@ -114,6 +114,12 @@ func (timeline *redisSortedSetTimeline) AddItem(item microsub.Item) (bool, error
|
||||||
item.Published = time.Now().Format(time.RFC3339)
|
item.Published = time.Now().Format(time.RFC3339)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix date when it almost matches with RFC3339, except the colon in the timezone
|
||||||
|
format := "2006-01-02T15:04:05Z0700"
|
||||||
|
if parsedDate, err := time.Parse(format, item.Published); err == nil {
|
||||||
|
item.Published = parsedDate.Format(time.RFC3339)
|
||||||
|
}
|
||||||
|
|
||||||
data, err := json.Marshal(item)
|
data, err := json.Marshal(item)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, fmt.Errorf("couldn't marshal item for redis: %s", err)
|
return false, fmt.Errorf("couldn't marshal item for redis: %s", err)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user