From aec2341a5a5589e5940a1601efbb7de6f7f9e7dd Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Tue, 16 Oct 2018 10:53:30 +0100 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BE=AE=E5=8D=9A-=E6=96=B9?= =?UTF-8?q?=E6=A1=882=20=E6=97=A5=E6=9C=9F=E9=94=99=E8=AF=AF=20(#900)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #898 --- utils/date.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/utils/date.js b/utils/date.js index f69a87413..7eedd9f4c 100644 --- a/utils/date.js +++ b/utils/date.js @@ -29,9 +29,6 @@ module.exports = (html, timeZone) => { } else if (/(\d+)-(\d+) (\d+):(\d+)/.exec(html)) { math = /(\d+)-(\d+) (\d+):(\d+)/.exec(html); date = new Date(date.getFullYear(), parseInt(math[1]) - 1, math[2], math[3], math[4]); - } else if (/(\d+):(\d+)/.exec(html)) { - math = /(\d+):(\d+)/.exec(html); - date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), math[1], math[2]); } else if (/(\d+)月(\d+)日 (\d+):(\d+)/.exec(html)) { math = /(\d+)月(\d+)日 (\d+):(\d+)/.exec(html); date = new Date(date.getFullYear(), parseInt(math[1]) - 1, math[2], math[3], math[4]); @@ -41,7 +38,11 @@ module.exports = (html, timeZone) => { } else if (/(\d+)-(\d+)/.exec(html)) { math = /(\d+)-(\d+)/.exec(html); date = new Date(date.getFullYear(), parseInt(math[1]) - 1, math[2]); + } else if (/(\d+):(\d+)/.exec(html)) { + math = /(\d+):(\d+)/.exec(html); + date = new Date(date.getFullYear(), date.getMonth(), date.getDate(), math[1], math[2]); } + if (date && timeZone) { const serverOffset = new Date().getTimezoneOffset() / 60; return new Date(date.getTime() - 60 * 60 * 1000 * (timeZone + serverOffset)).toUTCString();