@@ -49,6 +49,19 @@ const generateRssFeed = async (locale: 'en_GB' | 'nb_NO') => {
4949 const publishDate = new Date ( article . publishDateTime ) . toUTCString ( )
5050 console . log ( 'article.publishDateTime' , article . publishDateTime )
5151 console . log ( 'publishDate' , publishDate )
52+ const dateFormat = article . lang === 'nb_NO' ? 'd. MMMM yyyy hh:mm' : 'd MMMM yyyy hh:mm'
53+
54+ const getTimezoneAbbreviation = ( date : Date , timeZone : string ) => {
55+ const parts = new Intl . DateTimeFormat ( 'en-GB' , {
56+ timeZone,
57+ timeZoneName : 'short' ,
58+ } ) . formatToParts ( date )
59+
60+ const tzPart = parts . find ( ( p ) => p . type === 'timeZoneName' )
61+
62+ // TS-safe: fallback in case it's undefined
63+ return tzPart ?. value ?? ''
64+ }
5265
5366 // Format the main pubDate
5467 //const formattedPubDate = //format(new TZDate(publishDate, 'Europe/Oslo'), 'EEE, dd MMM yyyy HH:mm:ss xxxx')
@@ -64,9 +77,14 @@ const generateRssFeed = async (locale: 'en_GB' | 'nb_NO') => {
6477 <pubDate>${ publishDate } </pubDate>
6578 <description>${ toPlainText ( article . ingress ) } </description>
6679 ${ categoryTag ? `<category>${ mapCategoryToId ( categoryTag , locale ) } </category>` : '<category />' }
67- <nl:extra1>${ format ( new TZDate ( publishDate , 'Europe/Oslo' ) , "d.MMMM yyyy hh:mm ('CEST')" , {
68- locale : article . lang === 'nb_NO' ? nb : enGB ,
69- } ) } </nl:extra1>
80+ <nl:extra1>${
81+ format ( new TZDate ( publishDate , 'Europe/Oslo' ) , dateFormat , {
82+ locale : article . lang === 'nb_NO' ? nb : enGB ,
83+ } ) +
84+ ' (' +
85+ getTimezoneAbbreviation ( new TZDate ( publishDate , 'Europe/Oslo' ) , 'Europe/Oslo' ) +
86+ ')'
87+ } </nl:extra1>
7088 ${
7189 hero ?. image ?. asset
7290 ? `<media:content medium="image" type="image/jpeg" url="${ encodedUrl } ">
0 commit comments