use four-digit years for RSS pubDate (#3907)

zio/stable
bnewbold 2024-05-08 09:33:38 -07:00 committed by GitHub
parent 38198fdf7f
commit f3515e2673
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,6 @@ import (
"fmt"
"net/http"
"strings"
"time"
appbsky "github.com/bluesky-social/indigo/api/bsky"
"github.com/bluesky-social/indigo/atproto/syntax"
@ -13,6 +12,9 @@ import (
"github.com/labstack/echo/v4"
)
// time.RFC822Z, but with four digit year. used for RSS pubData.
var FullYearRFC822Z = "02 Jan 2006 15:04 -0700"
type ItemGUID struct {
XMLName xml.Name `xml:"guid"`
Value string `xml:",chardata"`
@ -107,7 +109,7 @@ func (srv *Server) WebProfileRSS(c echo.Context) error {
pubDate := ""
createdAt, err := syntax.ParseDatetimeLenient(rec.CreatedAt)
if nil == err {
pubDate = createdAt.Time().Format(time.RFC822Z)
pubDate = createdAt.Time().Format(FullYearRFC822Z)
}
posts = append(posts, Item{
Link: fmt.Sprintf("https://%s/profile/%s/post/%s", req.Host, pv.Handle, aturi.RecordKey().String()),