Преглед изворни кода

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