diff --git a/package.json b/package.json index 6c8729d7..29eb12b6 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ }, "dependencies": { "async-validator": "^1.7.1", - "core-js": "^2.4.1", + "core-js": "^2.5.0", "deepmerge": "^1.5.0", "popper.js": "^0.6.4", "tinycolor2": "^1.4.1" diff --git a/src/components/date-picker/util.js b/src/components/date-picker/util.js index 49326333..eb865f32 100644 --- a/src/components/date-picker/util.js +++ b/src/components/date-picker/util.js @@ -1,9 +1,17 @@ import dateUtil from '../../utils/date'; export const toDate = function(date) { - date = new Date(date); - if (isNaN(date.getTime())) return null; - return date; + let _date = new Date(date); + // IE patch start (#1422) + if (isNaN(_date.getTime()) && typeof date === 'string'){ + _date = date.split('-').map(Number); + _date[1] += 1; + _date = new Date(..._date); + } + // IE patch end + + if (isNaN(_date.getTime())) return null; + return _date; }; export const formatDate = function(date, format) { diff --git a/src/index.js b/src/index.js index 25661028..cd1b054f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,5 @@ // es6 polyfill +import 'core-js/fn/array/find'; import 'core-js/fn/array/find-index'; import Affix from './components/affix';