Merge pull request #2172 from SergioCrisostomo/fix-2164

format string dates in daterange also
This commit is contained in:
Aresn 2017-10-23 20:22:51 -05:00 committed by GitHub
commit c61015d19d
3 changed files with 50 additions and 2 deletions

View file

@ -513,7 +513,7 @@
if (val && type === 'time' && !(val instanceof Date)) {
val = parser(val, this.format || DEFAULT_FORMATS[type]);
} else if (val && type === 'timerange' && Array.isArray(val) && val.length === 2 && !(val[0] instanceof Date) && !(val[1] instanceof Date)) {
} else if (val && type.match(/range$/) && Array.isArray(val) && val.filter(Boolean).length === 2 && !(val[0] instanceof Date) && !(val[1] instanceof Date)) {
val = val.join(RANGE_SEPARATOR);
val = parser(val, this.format || DEFAULT_FORMATS[type]);
} else if (typeof val === 'string' && type.indexOf('time') !== 0 ){