Skip to content

Commit

Permalink
Date-picker: fix week picker's value-format (ElemeFE#13754)
Browse files Browse the repository at this point in the history
  • Loading branch information
wacky6 authored and iamkun committed Mar 4, 2019
1 parent 1711e60 commit e52c7e0
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions packages/date-picker/src/picker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit e52c7e0

Please sign in to comment.