| | |
| | | var moment = require('moment'); |
| | | |
| | | var Wrapper = createClass({ |
| | | getInitialState: function() { |
| | | return { |
| | | dateFormat: 'YYYY-MM-DD' |
| | | }; |
| | | }, |
| | | getInitialState: function() { |
| | | return { |
| | | dateFormat: 'YYYY-MM-DD' |
| | | }; |
| | | }, |
| | | |
| | | updateFormat: function(format) { |
| | | console.log('changing state'); |
| | | this.setState({ |
| | | dateFormat: 'DD.MM.YYYY' |
| | | }); |
| | | }, |
| | | updateFormat: function(format) { |
| | | console.log('changing state'); |
| | | this.setState({ |
| | | dateFormat: 'DD.MM.YYYY' |
| | | }); |
| | | }, |
| | | |
| | | componentDidMount: function() { |
| | | setTimeout(this.updateFormat, 2000); |
| | | }, |
| | | componentDidMount: function() { |
| | | setTimeout(this.updateFormat, 2000); |
| | | }, |
| | | |
| | | render: function() { |
| | | return React.createElement(DateTime, |
| | | { dateFormat: this.state.dateFormat, timeFormat: false, defaultValue: moment() }); |
| | | } |
| | | render: function() { |
| | | return React.createElement(DateTime, { |
| | | dateFormat: this.state.dateFormat, |
| | | timeFormat: false, |
| | | defaultValue: moment() |
| | | }); |
| | | } |
| | | }); |
| | | |
| | | ReactDOM.render( |
| | | React.createElement(Wrapper), |
| | | document.getElementById('datetime') |
| | | React.createElement(Wrapper), |
| | | document.getElementById('datetime') |
| | | ); |