From e2ab2b49f3e5543d8ce483d4766fcefa5e2fea57 Mon Sep 17 00:00:00 2001 From: wu-h Date: Tue, 28 Apr 2015 16:08:49 +0800 Subject: [PATCH] FIX: addMinute, addHour, subtractMinute, subtractHour are now updating inputValue. This is more logical and actually follows the orginal package. --- src/DateTimeField.jsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/DateTimeField.jsx b/src/DateTimeField.jsx index 0cf02890..f0b1bf2e 100644 --- a/src/DateTimeField.jsx +++ b/src/DateTimeField.jsx @@ -117,14 +117,20 @@ DateTimeField = React.createClass({ return this.setState({ selectedDate: this.state.selectedDate.clone().add(1, "minutes") }, function() { - return this.props.onChange(this.state.selectedDate.format(this.props.format)); + this.props.onChange(this.state.selectedDate.format(this.props.format)); + return this.setState({ + inputValue: this.state.selectedDate.format(this.props.inputFormat) + }); }); }, addHour: function() { return this.setState({ selectedDate: this.state.selectedDate.clone().add(1, "hours") }, function() { - return this.props.onChange(this.state.selectedDate.format(this.props.format)); + this.props.onChange(this.state.selectedDate.format(this.props.format)); + return this.setState({ + inputValue: this.state.selectedDate.format(this.props.inputFormat) + }); }); }, addMonth: function() { @@ -146,14 +152,20 @@ DateTimeField = React.createClass({ return this.setState({ selectedDate: this.state.selectedDate.clone().subtract(1, "minutes") }, function() { - return this.props.onChange(this.state.selectedDate.format(this.props.format)); + this.props.onChange(this.state.selectedDate.format(this.props.format)); + return this.setState({ + inputValue: this.state.selectedDate.format(this.props.inputFormat) + }); }); }, subtractHour: function() { return this.setState({ selectedDate: this.state.selectedDate.clone().subtract(1, "hours") }, function() { - return this.props.onChange(this.state.selectedDate.format(this.props.format)); + this.props.onChange(this.state.selectedDate.format(this.props.format)); + return this.setState({ + inputValue: this.state.selectedDate.format(this.props.inputFormat) + }); }); }, subtractMonth: function() {