浏览代码

fix: the date string cannot be converted to Date

2000-10-10 -> Invalid Date, must use 2000/10/10 format in some browers
daigang 3 年之前
父节点
当前提交
0405dff25a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/utils/event.js

+ 1 - 1
src/utils/event.js

@@ -63,7 +63,7 @@ function offsetWeek (week, offset) {
 }
 
 export function toDate (val) {
-  return val && new Date(val)
+  return val && new Date(typeof val === 'string' ? val.replace(/-/g, '/') : val)
 }
 
 export function pickMax (a, b) {