I'm having trouble binding the minDate
and maxDate
of two date pickers ("begin" and "end) using ExtReact 6.5.2. Here is the code sample:
import React, { Component } from 'react';
import { Container, DatePickerField, FormPanel, TextField } from '@extjs/ext-react';
export default class MyExample extends Component {
constructor(props) {
super(props);
this.state = {
beginPickerValue: null,
endPickerValue: null
};
}
render() {
return (
<Container layout="center">
<FormPanel
defaults={{ clearable: true, editable: false }}
shadow
>
<DatePickerField
label="Begin"
onChange={(datePicker, newValue) => this.setState({beginPickerValue: newValue})}
maxValue={this.state.endPickerValue}
/>
<DatePickerField
label="End"
onChange={(datePicker, newValue) => this.setState({beginPickerValue: newValue})}
minValue={this.state.endPickerValue}
/>
</FormPanel>
</Container>
)
}
}
In my setup, using Chrome, I get the following error:
Uncaught Error: Date object or string in dateFormat required
at new Ext.Error (ext.js:5817)
at Function.raise (ext.js:5843)
at Object.Ext.raise (ext.js:5860)
at constructor.applyMaxDate (ext.js:59619)
at constructor.setter [as setMaxDate] (ext.js:8892)
at Ext.Configurator.configure (ext.js:9171)
at constructor.initConfig (ext.js:9771)
at constructor (ext.js:13108)
at constructor (ext.js:23660)
at constructor.callParent (ext.js:9746)
I've used the exact code above in Sencha's "Examples" section for DatePickerField
(see below links). The code runs and the fields are rendered, but the max and min bindings do not appear to be observed when setting dates.
Please note that as of this writing, in order to demo you'll have to use Sencha's "Examples" code block within the ExtReact 6.5.1 docs to replicate. When using the DatePickerField
example code block for versions 6.5.2 or 6.5.3, you get the following error even when attempting to run Sencha's default sample code:
Uncaught ReferenceError: Ext is not defined
at app.js:1
I would provide a fiddle using Sencha's own ExtReact fiddler, but that too, seems to have problems running its own sample code. :/
As I understand it, there should be no need for additional functions or need to trigger from an event. Within React, the changes to state
should appropriately reconfigure the maxDate
and minDate
configurations for the DateFieldPicker
.
Any help is greatly appreciated...