Browse Source

Fix time in webmentions

pull/1/head
Yarmo Mackenbach 1 month ago
parent
commit
1279d9307c
2 changed files with 11 additions and 3 deletions
  1. +10
    -2
      server/util.js
  2. +1
    -1
      views/post.pug

+ 10
- 2
server/util.js 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) => {

+ 1
- 1
views/post.pug 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

Loading…
Cancel
Save