Date-picker: fix week picker's value-format (#13754)

pull/14569/head
Jiewei Qian 2019-03-04 18:55:23 +11:00 committed by iamkun
parent 1711e60acf
commit e52c7e06df
1 changed files with 4 additions and 12 deletions

View File

@ -2,7 +2,7 @@
<el-input
class="el-date-editor"
:class="'el-date-editor--' + type"
:readonly="!editable || readonly || type === 'dates'"
:readonly="!editable || readonly || type === 'dates' || type === 'week'"
:disabled="pickerDisabled"
:size="pickerSize"
:name="name"
@ -190,17 +190,9 @@ const TYPE_VALUE_RESOLVER_MAP = {
: date.replace(/W/, week);
return date;
},
parser(text) {
const array = (text || '').split('w');
if (array.length === 2) {
const year = Number(array[0]);
const month = Number(array[1]);
if (!isNaN(year) && !isNaN(month) && month < 54) {
return text;
}
}
return null;
parser(text, format) {
// parse as if a normal date
return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
}
},
date: {