mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 04:26:41 -04:00

* Revert "add note link to issue in collection2 on mutation insert, remove debug console logs on mutation edit" This reverts commit7a15103de7
. * Revert "node simpl-schema + collection2-core: fix vote by specifying the right type of the array (dont use blackbox in the end!)" This reverts commite894c3224c
. * Revert "add graphql date type (fix problem with node simple schema), fix an update bug on date picker, add edit check on custom post item, add `blackbox: true` for arrays field (validation problem with simple-schema)" This reverts commit9d84fbec98
. * Revert "use node `simpl-schema` by aldeed to replace `meteor/aldeed:simple-schema` ; use the meteor collection2 core package as recommended" This reverts commit016935f4fa
. * revert before node-simple-schema, fix obj.hasOwnProperty undefined error thrown by simple-schema & collection2 * CustomPostsItem: check on renderActions; withDocument/List: pollInterval 20seconds by default; DateTime form component enhancement + GraphQLDate type
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
import React, { PropTypes, Component } from 'react';
|
|
import DateTimePicker from 'react-datetime';
|
|
// import moment from 'moment';
|
|
|
|
class DateTime extends Component {
|
|
|
|
constructor(props) {
|
|
super(props);
|
|
|
|
this.updateDate = this.updateDate.bind(this);
|
|
}
|
|
|
|
// when the datetime picker has mounted, SmartForm will catch the date value (no formsy mixin in this component)
|
|
componentDidMount() {
|
|
this.updateDate(this.props.value || new Date());
|
|
}
|
|
|
|
updateDate(date) {
|
|
this.context.updateCurrentValue(this.props.name, date);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<div className="form-group row">
|
|
<label className="control-label col-sm-3">{this.props.label}</label>
|
|
<div className="col-sm-9">
|
|
<DateTimePicker
|
|
value={this.props.value || new Date()}
|
|
// newDate argument is a Moment object given by react-datetime
|
|
onChange={newDate => this.updateDate(newDate._d)}
|
|
format={"x"}
|
|
inputProps={{name: this.props.name}}
|
|
/>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
DateTime.propTypes = {
|
|
control: React.PropTypes.any,
|
|
datatype: React.PropTypes.any,
|
|
group: React.PropTypes.any,
|
|
label: React.PropTypes.string,
|
|
name: React.PropTypes.string,
|
|
value: React.PropTypes.any,
|
|
};
|
|
|
|
DateTime.contextTypes = {
|
|
addToAutofilledValues: React.PropTypes.func,
|
|
updateCurrentValue: React.PropTypes.func,
|
|
};
|
|
|
|
export default DateTime;
|