fix time formattin bug
Co-authored-by: Deniz Kusefoglu <deniz@influxdata.com>pull/3030/head
parent
eca5394edc
commit
2a738df64e
|
@ -35,18 +35,22 @@ class GraphOptionsTimeFormat extends PureComponent<Props, State> {
|
||||||
return this.props.onTimeFormatChange
|
return this.props.onTimeFormatChange
|
||||||
}
|
}
|
||||||
|
|
||||||
|
handleChangeFormat = format => {
|
||||||
|
this.onTimeFormatChange(format)
|
||||||
|
this.setState({format})
|
||||||
|
}
|
||||||
|
|
||||||
handleChooseFormat = (formatOption: TimeFormatOptions) => {
|
handleChooseFormat = (formatOption: TimeFormatOptions) => {
|
||||||
if (formatOption.text === TIME_FORMAT_CUSTOM) {
|
if (formatOption.text === TIME_FORMAT_CUSTOM) {
|
||||||
this.setState({customFormat: true})
|
this.setState({customFormat: true})
|
||||||
} else {
|
} else {
|
||||||
this.setState({format: formatOption.text, customFormat: false})
|
|
||||||
this.onTimeFormatChange(formatOption.text)
|
this.onTimeFormatChange(formatOption.text)
|
||||||
|
this.setState({format: formatOption.text, customFormat: false})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {format, customFormat} = this.state
|
const {format, customFormat} = this.state
|
||||||
const {onTimeFormatChange} = this.props
|
|
||||||
const tipContent =
|
const tipContent =
|
||||||
'For information on formatting, see http://momentjs.com/docs/#/parsing/string-format/'
|
'For information on formatting, see http://momentjs.com/docs/#/parsing/string-format/'
|
||||||
|
|
||||||
|
@ -76,8 +80,8 @@ class GraphOptionsTimeFormat extends PureComponent<Props, State> {
|
||||||
<InputClickToEdit
|
<InputClickToEdit
|
||||||
wrapperClass="field-controls-input "
|
wrapperClass="field-controls-input "
|
||||||
value={format}
|
value={format}
|
||||||
onBlur={onTimeFormatChange}
|
onBlur={this.handleChangeFormat}
|
||||||
onChange={onTimeFormatChange}
|
onChange={this.handleChangeFormat}
|
||||||
placeholder="Enter custom format..."
|
placeholder="Enter custom format..."
|
||||||
appearAsNormalInput={true}
|
appearAsNormalInput={true}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue