Merge pull request #2464 from omnivore-app/fix/wechat-published-date

use asia/shanghai timezone to format published date in wechat articles
This commit is contained in:
Hongbo Wu 2023-07-04 20:48:03 +08:00 committed by GitHub
commit 473cf2daa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,10 +16,10 @@ export class WeixinQqHandler extends ContentHandler {
const publishTime = dom.querySelector('#publish_time')?.textContent
if (publishTime) {
const dateTimeFormat = 'yyyy-LL-dd HH:mm'
const publishTimeISO = DateTime.fromFormat(
publishTime,
dateTimeFormat
).toISO()
// published time is in UTC+8
const publishTimeISO = DateTime.fromFormat(publishTime, dateTimeFormat, {
zone: 'Asia/Shanghai',
}).toISO()
// create a meta node to store the publish time in ISO format
const metaNode = dom.createElement('meta')