From 7cb6c5e7b8df781bb3e251557f9861326710c6ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=87=E5=A4=A9?= Date: Tue, 5 Jun 2018 01:26:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dgmdate=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=B7=B2=E7=A7=BB=E9=99=A4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tool.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/tool.js b/lib/tool.js index 903a6b6..54bfb89 100644 --- a/lib/tool.js +++ b/lib/tool.js @@ -62,7 +62,10 @@ class Tool { date: function(str, format = '') { //去除参数里多余的引号 format = format.replace(/^['"]/, '').replace(/['"]$/, '') - return gmdate(format, str) + if (isFinite(str)) { + str = +str + } + return new Date(str).format(format) } } }