From b9ed4a9e269d364420ef468ac35bcc718ffe4df2 Mon Sep 17 00:00:00 2001 From: sanmmmm Date: Mon, 12 Aug 2019 11:14:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=87=E6=A1=A3=E9=94=99=E8=AF=AF/=20?= =?UTF-8?q?=E5=B0=8Fbug=20(#2833)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/other.md | 2 +- lib/routes/chinadaily/english.js | 2 +- lib/routes/getitfree/utils.js | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/other.md b/docs/other.md index 48621f092..98c53e209 100644 --- a/docs/other.md +++ b/docs/other.md @@ -1235,7 +1235,7 @@ type 为 all 时,category 参数不支持 cost 和 free ### 字幕列表 - + 类型 diff --git a/lib/routes/chinadaily/english.js b/lib/routes/chinadaily/english.js index 890a9927f..9e1f89643 100644 --- a/lib/routes/chinadaily/english.js +++ b/lib/routes/chinadaily/english.js @@ -21,7 +21,7 @@ module.exports = async (ctx) => { const desc = $item('.gy_box_txt3').text(); return { title, - link, + link: link.trim().replace(/^\/\//, 'https://'), description: [``, desc].join('
'), }; }) diff --git a/lib/routes/getitfree/utils.js b/lib/routes/getitfree/utils.js index 3273141e1..d0cb47dfe 100644 --- a/lib/routes/getitfree/utils.js +++ b/lib/routes/getitfree/utils.js @@ -1,4 +1,6 @@ const cheerio = require('cheerio'); +const dayJs = require('dayjs'); +require('dayjs/locale/zh-cn'); const getDeadlineStr = ($, countDownNodeSelector) => { const countDownNode = $(countDownNodeSelector); @@ -13,7 +15,9 @@ const getDeadlineStr = ($, countDownNodeSelector) => { const index = args[args.length - 2]; return index === 10 ? ' ' : index < 10 ? '-' : ':'; }); - deadlineStr = `截至日期: ${new Date(dateStr).toUTCString()}`; + deadlineStr = `截至日期: ${dayJs(dateStr) + .locale('zh-cn') + .format('YYYY-MM-DD HH:mm:ss')}`; } return deadlineStr; };