1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 09:35:10 +01:00

Fix datetime selector

This commit is contained in:
vrde 2015-06-01 14:49:13 +02:00
parent f9a3be61d2
commit 165d2e9b1d
2 changed files with 13 additions and 13 deletions

View File

@ -108,13 +108,15 @@ ${username}`;
submitted={this.state.submitted}/> submitted={this.state.submitted}/>
<div className="row"> <div className="row">
<div className="col-md-6"> <div className="col-md-6">
<InputDate ref="startdate"/> <InputDate
ref="startdate"
placeholderText="Loan start date" />
</div> </div>
<div className="col-md-6 form-group"> <div className="col-md-6 form-group">
<InputText <InputText
ref="enddate" ref="enddate"
name="enddate" name="enddate"
placeHolder="Loan end date" placeholderText="Loan end date"
required="required" required="required"
type="text" type="text"
submitted={this.state.submitted}/> submitted={this.state.submitted}/>

View File

@ -8,19 +8,15 @@ let InputDate = React.createClass({
mixins : [AlertMixin], mixins : [AlertMixin],
getInitialState() { getInitialState() {
return {value: '2015-01-01', return {value: null,
alerts: null // needed in AlertMixin alerts: null // needed in AlertMixin
}; };
}, },
handleChange(moment_date) {
this.setState({value: moment_date.format("YYYY-MM-DD")}); handleChange(date) {
}, this.setState({value: date});
isValidDate: function (str) {
return (
/^[0-9]{4}$/.test(str) &&
moment(str, 'YYYY-MM-DD').isValid()
);
}, },
render: function () { render: function () {
let className = "form-control input-text-ascribe"; let className = "form-control input-text-ascribe";
let alerts = (this.props.submitted) ? null : this.state.alerts; let alerts = (this.props.submitted) ? null : this.state.alerts;
@ -28,7 +24,9 @@ let InputDate = React.createClass({
<DatePicker <DatePicker
key="example2" key="example2"
dateFormat="YYYY-MM-DD" dateFormat="YYYY-MM-DD"
selected={this.state.value}
onChange={this.handleChange} onChange={this.handleChange}
placeholderText={this.props.placeholderText}
/> />
); );
//return ( //return (