fix(route): yicai wrong pubDate (#7137)

This commit is contained in:
Queensferry 2021-03-11 14:05:26 +08:00 committed by GitHub
parent 5113c97a3d
commit e6734345ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
const date = require('@/utils/date');
const got = require('@/utils/got');
module.exports = async (ctx) => {
@ -15,11 +16,11 @@ module.exports = async (ctx) => {
const resList = response.data;
const item = resList.map((obj) => {
const { datekey, istop, url, newcontent, hm, indexTitle } = obj;
const dateStr = `${datekey.replace('.', '-')} ${hm}`;
const dateStr = `${datekey.replace(/\./g, '-')} ${hm}`;
return {
title: indexTitle.length === newcontent.length ? indexTitle : `${indexTitle}...`,
description: [istop ? '置顶:' : '', newcontent].filter((str) => !!str).join('<br/>'),
pubDate: new Date(dateStr).toUTCString(),
pubDate: date(dateStr, +8),
link: `${baseUrl}${url}`,
};
});