fix bug in getting-started - date is null when clear the DatePick (#10111)

This commit is contained in:
Open Next 2018-04-17 16:49:11 +08:00 committed by Wei Zhu
parent ee4f788ae0
commit ad721111a4
2 changed files with 4 additions and 4 deletions

4
docs/react/getting-started.en-US.md Normal file → Executable file
View File

@ -79,7 +79,7 @@ class App extends React.Component {
};
}
handleChange(date) {
message.info('Selected Date: ' + date.toString());
message.info('Selected Date: ' + (date ? date.toString() : ''));
this.setState({ date });
}
render() {
@ -87,7 +87,7 @@ class App extends React.Component {
<LocaleProvider locale={frFR}>
<div style={{ width: 400, margin: '100px auto' }}>
<DatePicker onChange={value => this.handleChange(value)} />
<div style={{ marginTop: 20 }}>Date: {this.state.date.toString()}</div>
<div style={{ marginTop: 20 }}>Date: {this.state.date && this.state.date.toString()}</div>
</div>
</LocaleProvider>
);

4
docs/react/getting-started.zh-CN.md Normal file → Executable file
View File

@ -81,7 +81,7 @@ class App extends React.Component {
};
}
handleChange(date) {
message.info('您选择的日期是: ' + date.toString());
message.info('您选择的日期是: ' + (date ? date.toString() : ''));
this.setState({ date });
}
render() {
@ -89,7 +89,7 @@ class App extends React.Component {
<LocaleProvider locale={zhCN}>
<div style={{ width: 400, margin: '100px auto' }}>
<DatePicker onChange={value => this.handleChange(value)} />
<div style={{ marginTop: 20 }}>当前日期:{this.state.date.toString()}</div>
<div style={{ marginTop: 20 }}>当前日期:{this.state.date && this.state.date.toString()}</div>
</div>
</LocaleProvider>
);