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
|
||||
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: {
|
||||
|
|
Loading…
Reference in New Issue