mirror of https://github.com/ElemeFE/element
Date-picker: fix week picker's value-format (#13754)
parent
1711e60acf
commit
e52c7e06df
|
@ -2,7 +2,7 @@
|
||||||
<el-input
|
<el-input
|
||||||
class="el-date-editor"
|
class="el-date-editor"
|
||||||
:class="'el-date-editor--' + type"
|
:class="'el-date-editor--' + type"
|
||||||
:readonly="!editable || readonly || type === 'dates'"
|
:readonly="!editable || readonly || type === 'dates' || type === 'week'"
|
||||||
:disabled="pickerDisabled"
|
:disabled="pickerDisabled"
|
||||||
:size="pickerSize"
|
:size="pickerSize"
|
||||||
:name="name"
|
:name="name"
|
||||||
|
@ -190,17 +190,9 @@ const TYPE_VALUE_RESOLVER_MAP = {
|
||||||
: date.replace(/W/, week);
|
: date.replace(/W/, week);
|
||||||
return date;
|
return date;
|
||||||
},
|
},
|
||||||
parser(text) {
|
parser(text, format) {
|
||||||
const array = (text || '').split('w');
|
// parse as if a normal date
|
||||||
if (array.length === 2) {
|
return TYPE_VALUE_RESOLVER_MAP.date.parser(text, format);
|
||||||
const year = Number(array[0]);
|
|
||||||
const month = Number(array[1]);
|
|
||||||
|
|
||||||
if (!isNaN(year) && !isNaN(month) && month < 54) {
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
date: {
|
date: {
|
||||||
|
|
Loading…
Reference in New Issue