use four-digit years for RSS pubDate (#3907)
parent
38198fdf7f
commit
f3515e2673
|
@ -5,7 +5,6 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
appbsky "github.com/bluesky-social/indigo/api/bsky"
|
appbsky "github.com/bluesky-social/indigo/api/bsky"
|
||||||
"github.com/bluesky-social/indigo/atproto/syntax"
|
"github.com/bluesky-social/indigo/atproto/syntax"
|
||||||
|
@ -13,6 +12,9 @@ import (
|
||||||
"github.com/labstack/echo/v4"
|
"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 {
|
type ItemGUID struct {
|
||||||
XMLName xml.Name `xml:"guid"`
|
XMLName xml.Name `xml:"guid"`
|
||||||
Value string `xml:",chardata"`
|
Value string `xml:",chardata"`
|
||||||
|
@ -107,7 +109,7 @@ func (srv *Server) WebProfileRSS(c echo.Context) error {
|
||||||
pubDate := ""
|
pubDate := ""
|
||||||
createdAt, err := syntax.ParseDatetimeLenient(rec.CreatedAt)
|
createdAt, err := syntax.ParseDatetimeLenient(rec.CreatedAt)
|
||||||
if nil == err {
|
if nil == err {
|
||||||
pubDate = createdAt.Time().Format(time.RFC822Z)
|
pubDate = createdAt.Time().Format(FullYearRFC822Z)
|
||||||
}
|
}
|
||||||
posts = append(posts, Item{
|
posts = append(posts, Item{
|
||||||
Link: fmt.Sprintf("https://%s/profile/%s/post/%s", req.Host, pv.Handle, aturi.RecordKey().String()),
|
Link: fmt.Sprintf("https://%s/profile/%s/post/%s", req.Host, pv.Handle, aturi.RecordKey().String()),
|
||||||
|
|
Loading…
Reference in New Issue