From e6734345eebefae795ca91924661c139b454fc22 Mon Sep 17 00:00:00 2001 From: Queensferry Date: Thu, 11 Mar 2021 14:05:26 +0800 Subject: [PATCH] fix(route): yicai wrong pubDate (#7137) --- lib/routes/yicai/brief.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/routes/yicai/brief.js b/lib/routes/yicai/brief.js index 80bf58680..deba8af66 100644 --- a/lib/routes/yicai/brief.js +++ b/lib/routes/yicai/brief.js @@ -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('
'), - pubDate: new Date(dateStr).toUTCString(), + pubDate: date(dateStr, +8), link: `${baseUrl}${url}`, }; });