mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Fix datetime selector
This commit is contained in:
parent
f9a3be61d2
commit
165d2e9b1d
@ -108,13 +108,15 @@ ${username}`;
|
||||
submitted={this.state.submitted}/>
|
||||
<div className="row">
|
||||
<div className="col-md-6">
|
||||
<InputDate ref="startdate"/>
|
||||
<InputDate
|
||||
ref="startdate"
|
||||
placeholderText="Loan start date" />
|
||||
</div>
|
||||
<div className="col-md-6 form-group">
|
||||
<InputText
|
||||
ref="enddate"
|
||||
name="enddate"
|
||||
placeHolder="Loan end date"
|
||||
placeholderText="Loan end date"
|
||||
required="required"
|
||||
type="text"
|
||||
submitted={this.state.submitted}/>
|
||||
@ -141,4 +143,4 @@ ${username}`;
|
||||
}
|
||||
});
|
||||
|
||||
export default LoanForm;
|
||||
export default LoanForm;
|
||||
|
@ -8,19 +8,15 @@ let InputDate = React.createClass({
|
||||
mixins : [AlertMixin],
|
||||
|
||||
getInitialState() {
|
||||
return {value: '2015-01-01',
|
||||
return {value: null,
|
||||
alerts: null // needed in AlertMixin
|
||||
};
|
||||
},
|
||||
handleChange(moment_date) {
|
||||
this.setState({value: moment_date.format("YYYY-MM-DD")});
|
||||
},
|
||||
isValidDate: function (str) {
|
||||
return (
|
||||
/^[0-9]{4}$/.test(str) &&
|
||||
moment(str, 'YYYY-MM-DD').isValid()
|
||||
);
|
||||
|
||||
handleChange(date) {
|
||||
this.setState({value: date});
|
||||
},
|
||||
|
||||
render: function () {
|
||||
let className = "form-control input-text-ascribe";
|
||||
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
||||
@ -28,7 +24,9 @@ let InputDate = React.createClass({
|
||||
<DatePicker
|
||||
key="example2"
|
||||
dateFormat="YYYY-MM-DD"
|
||||
selected={this.state.value}
|
||||
onChange={this.handleChange}
|
||||
placeholderText={this.props.placeholderText}
|
||||
/>
|
||||
);
|
||||
//return (
|
||||
@ -50,4 +48,4 @@ let InputDate = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
export default InputDate;
|
||||
export default InputDate;
|
||||
|
Loading…
Reference in New Issue
Block a user