| | |
| | | const { config } = this.props |
| | | |
| | | if (config.checkShift && nextProps.config.initval && nextProps.config.initval !== config.initval) { |
| | | let val = nextProps.config.initval.split(',') |
| | | let value = nextProps.config.initval || null |
| | | |
| | | if (this.state.mode === 'daterange') { |
| | | if (value) { |
| | | let val = value.split(',') |
| | | value = [moment(val[0], this.state.format), moment(val[1], this.state.format)] |
| | | } else { |
| | | value = [null, null] |
| | | } |
| | | } else if (value) { |
| | | value = moment(value, this.state.format) |
| | | } |
| | | |
| | | this.setState({ |
| | | value: [moment(val[0], config.format), moment(val[1], config.format)] |
| | | value: value |
| | | }) |
| | | |
| | | this.props.onChange(nextProps.config.initval, true) |