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) } } }