RSS pubDate is now in a right format.

This commit is contained in:
Alexander Andreev 2022-01-22 23:20:26 +04:00
parent b30b85fb72
commit 527f62722b
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F
3 changed files with 3 additions and 1 deletions

View File

@ -141,6 +141,7 @@ const pug = new koaPug({
locals: { locals: {
date_: (date, tz) => util.datetime(date, util.date_formats.post_date, tz), date_: (date, tz) => util.datetime(date, util.date_formats.post_date, tz),
date_id: (date, tz) => util.datetime(date, util.date_formats.id_date, tz), date_id: (date, tz) => util.datetime(date, util.date_formats.id_date, tz),
date_rss: date => util.datetime(date, util.date_formats.rss_date, "UTC"),
rssLink: util.rssLink }, rssLink: util.rssLink },
app: app app: app
}); });

View File

@ -12,7 +12,7 @@ rss(version='2.0')
title= item.title title= item.title
category= item.category category= item.category
guid!= `${item.category.toLowerCase()}-${date_id(item.date, "UTC")}` guid!= `${item.category.toLowerCase()}-${date_id(item.date, "UTC")}`
pubDate= item.date pubDate= date_rss(item.date)
link!= rssLink(schemahost, item.date, item.category.toLowerCase()) link!= rssLink(schemahost, item.date, item.category.toLowerCase())
author!= author author!= author
description description

View File

@ -3,6 +3,7 @@ const moment = require("moment-timezone");
const date_formats = Object.freeze({ const date_formats = Object.freeze({
post_date: "Do MMMM YYYY HH:mm:ss z", post_date: "Do MMMM YYYY HH:mm:ss z",
file_date: "YYYY-MM-DD HH:mm:ss z", file_date: "YYYY-MM-DD HH:mm:ss z",
rss_date: "ddd, DD MMM YYYY HH:mm:ss ZZ",
id_date: "YYYYMMDD-HHmm" }); id_date: "YYYYMMDD-HHmm" });
function datetime(date, format=date_formats.post_date, timezone="UTC") { function datetime(date, format=date_formats.post_date, timezone="UTC") {