Fix time in webmentions

This commit is contained in:
Yarmo Mackenbach 2020-09-25 19:00:48 +02:00
parent 4a9c8b0292
commit 1279d9307c
2 changed files with 11 additions and 3 deletions

View File

@ -77,7 +77,7 @@ const getNotes = async (opts) => {
url: `https://yarmo.eu/post/${fm.slug}`,
slug: fm.slug,
date: fm.date,
date_formatted: DateTime.fromFormat(fm.date, 'yyyy-LL-dd hh:mm:ss').setLocale("en").toLocaleString(DateTime.DATE_MED),
date_formatted: DateTime.fromFormat(fm.date, 'yyyy-LL-dd hh:mm:ss').setLocale("en").setZone('utc').toLocaleString(DateTime.DATE_MED),
published: fm.published,
discussion: fm.discussion,
content: md.render(fm.__content)
@ -104,7 +104,15 @@ const getWebmentions = async (url) => {
const data_1 = await getJSON(`https://webm.yarmo.eu/get?target=${url}`)
const data_2 = await getJSON(`https://webm.yarmo.eu/get?target=${url.replace('/post/', '/blog/')}`)
const data_3 = await getJSON(`https://webm.yarmo.eu/get?target=${url.replace('/post/', '/notes/')}`)
return data_1.concat(data_2).concat(data_3)
const dataRaw = data_1.concat(data_2).concat(data_3)
const data = _.map(dataRaw, (x) => {
x.date = DateTime.fromISO(x.created_at).setLocale("en").setZone('utc').toLocaleString(DateTime.DATE_MED),
x.time = DateTime.fromISO(x.created_at).setLocale("en").setZone('utc').toLocaleString(DateTime.TIME_24_WITH_SHORT_OFFSET)
return x
})
return data
}
const getRSS = async (opts) => {

View File

@ -12,7 +12,7 @@ mixin webmention(item)
if ('date' in item)
| on !{item.date}
if ('time' in item)
| at !{item.time} UTC
| at !{item.time}
else if (item.type == "comment")
.comment
p.quote