属性存在判断修改

This commit is contained in:
Kate605690919 2019-12-16 13:10:44 +08:00
parent f539b1d8e4
commit 6800339e97
2 changed files with 2 additions and 3 deletions

View File

@ -1016,7 +1016,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
if (typeof item === 'string') {
shortcut = this.getAvailableShortcuts(item);
shortcut.key = item;
} else if ('date' in item) {
} else if (item.date) {
shortcut = {
...item,
date: () => item.date

View File

@ -235,7 +235,6 @@ export class DateRangePicker extends React.Component<
this.handleClick = this.handleClick.bind(this);
this.handleKeyPress = this.handleKeyPress.bind(this);
this.handlePopOverClick = this.handlePopOverClick.bind(this);
this.renderRanges = this.renderRanges.bind(this);
const {format, joinValues, delimiter, value} = this.props;
this.state = {
@ -384,7 +383,7 @@ export class DateRangePicker extends React.Component<
if (typeof item === 'string') {
range = availableRanges[item];
range.key = item;
} else if ('endDate' in item && 'startDate' in item) {
} else if (item.startDate && item.endDate) {
range = {
...item,
startDate: () => item.startDate,