Commit 58ff14d782e940ac620794782ff5f00bca991234

Authored by Sergio Crisostomo
1 parent 8a4f9d5a

Make date more IE friendly

@@ -41,7 +41,7 @@ @@ -41,7 +41,7 @@
41 }, 41 },
42 "dependencies": { 42 "dependencies": {
43 "async-validator": "^1.7.1", 43 "async-validator": "^1.7.1",
44 - "core-js": "^2.4.1", 44 + "core-js": "^2.5.0",
45 "deepmerge": "^1.5.0", 45 "deepmerge": "^1.5.0",
46 "popper.js": "^0.6.4", 46 "popper.js": "^0.6.4",
47 "tinycolor2": "^1.4.1" 47 "tinycolor2": "^1.4.1"
src/components/date-picker/util.js
1 import dateUtil from '../../utils/date'; 1 import dateUtil from '../../utils/date';
2 2
3 export const toDate = function(date) { 3 export const toDate = function(date) {
4 - date = new Date(date);  
5 - if (isNaN(date.getTime())) return null;  
6 - return date; 4 + let _date = new Date(date);
  5 + // IE patch start (#1422)
  6 + if (isNaN(_date.getTime()) && typeof date === 'string'){
  7 + _date = date.split('-').map(Number);
  8 + _date[1] += 1;
  9 + _date = new Date(..._date);
  10 + }
  11 + // IE patch end
  12 +
  13 + if (isNaN(_date.getTime())) return null;
  14 + return _date;
7 }; 15 };
8 16
9 export const formatDate = function(date, format) { 17 export const formatDate = function(date, format) {
1 // es6 polyfill 1 // es6 polyfill
  2 +import 'core-js/fn/array/find';
2 import 'core-js/fn/array/find-index'; 3 import 'core-js/fn/array/find-index';
3 4
4 import Affix from './components/affix'; 5 import Affix from './components/affix';