Skip to content

Commit

Permalink
fix(Calendar): 修复由于 optionalTypes 导致日期无法选中
Browse files Browse the repository at this point in the history
close #1460
  • Loading branch information
smileShirmy committed Dec 18, 2021
1 parent 38279b3 commit 8e55230
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 6 additions & 3 deletions src/calendar/components/mounth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ Component({
},
properties: {
minDate: {
optionalTypes: [Object,String],
type: Object,
optionalTypes: [String, null],
},
maxDate: {
optionalTypes: [Object,String],
type: Object,
optionalTypes: [String, null],
},
formatter: {
type: null,
Expand All @@ -20,7 +22,8 @@ Component({
observer: 'setDays'
},
currentDate: {
optionalTypes: [Array],
type: Array,
optionalTypes: [null],
observer() {
this.setDays();
}
Expand Down
12 changes: 9 additions & 3 deletions src/calendar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Component({
},
defaultDate: {
optionalTypes: [String, Number, Date, Array],
value: '',
observer() {
this.setData({ currentDate: this.initCurrentDate() });
}
Expand All @@ -45,15 +46,18 @@ Component({
value: 'timestamp'
},
formatter: {
type: Object,
type: Function,
optionalTypes: [null],
value: null
},
minDate: {
optionalTypes: [String, Number],
type: String,
optionalTypes: [null, Number],
value: Date.now()
},
maxDate: {
optionalTypes: [String, Number],
type: String,
optionalTypes: [null, Number],
value: new Date(
new Date().getFullYear(),
new Date().getMonth() + 6,
Expand All @@ -62,10 +66,12 @@ Component({
},
minSelect: {
type: Number,
optionalTypes: [null],
value: null
},
maxSelect: {
type: Number,
optionalTypes: [null],
value: null
},
allowSameDay: Boolean,
Expand Down

0 comments on commit 8e55230

Please # to comment.