fix(DateRender.js): 修复日期render中设置空字符串出错bug

This commit is contained in:
huyueb 2017-11-06 14:25:59 +08:00
parent f73c0facd2
commit b7c196169b
1 changed files with 2 additions and 2 deletions

View File

@ -10,7 +10,7 @@ export default class DateRender extends Component {
};
handleChange = e => {
let { format } = this.props || "YYYY-MM-DD";
const value = e.format(format);
const value = e ? e.format(format) : "";
this.setState({ value, editable: false });
if (this.props.onChange) {
this.props.onChange(value);
@ -34,7 +34,7 @@ export default class DateRender extends Component {
const { value, editable } = this.state;
let { isclickTrigger } = this.props;
let cellContent = "";
let date_value = moment(value);
let date_value = value ? moment(value) : value;
if (editable) {
cellContent = isclickTrigger ? (
<div className="editable-cell-input-wrapper">