修复gmdate方法已移除的bug

master
宇天 2018-06-05 01:26:53 +08:00
parent b53aa1c4f5
commit 7cb6c5e7b8
1 changed files with 4 additions and 1 deletions

View File

@ -62,7 +62,10 @@ class Tool {
date: function(str, format = '') { date: function(str, format = '') {
//去除参数里多余的引号 //去除参数里多余的引号
format = format.replace(/^['"]/, '').replace(/['"]$/, '') format = format.replace(/^['"]/, '').replace(/['"]$/, '')
return gmdate(format, str) if (isFinite(str)) {
str = +str
}
return new Date(str).format(format)
} }
} }
} }