Skip to content
This repository was archived by the owner on Nov 16, 2018. It is now read-only.

Commit ee5b914

Browse files
committed
Fixes setSelectedDate
1 parent c3bd0bd commit ee5b914

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/DateTimeField.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ DateTimeField = React.createClass({
3737
},
3838
componentWillReceiveProps: function(nextProps) {
3939
return this.setState({
40-
viewDate: moment(nextProps.dateTime).startOf("month"),
41-
selectedDate: moment(nextProps.dateTime),
42-
inputValue: moment(nextProps.dateTime).format(nextProps.inputFormat)
40+
viewDate: moment(nextProps.dateTime, nextProps.format).startOf("month"),
41+
selectedDate: moment(nextProps.dateTime, nextProps.format),
42+
inputValue: moment(nextProps.dateTime, nextProps.format).format(nextProps.inputFormat)
4343
});
4444
},
4545
onChange: function(event) {
@@ -58,7 +58,7 @@ DateTimeField = React.createClass({
5858
},
5959
setSelectedDate: function(e) {
6060
return this.setState({
61-
selectedDate: this.state.viewDate.clone().date(parseInt(e.target.innerHTML))
61+
selectedDate: this.state.viewDate.clone().date(parseInt(e.target.innerHTML)).hour(this.state.selectedDate.hours()).minute(this.state.selectedDate.minutes())
6262
}, function() {
6363
this.closePicker();
6464
this.props.onChange(this.state.selectedDate.format(this.props.format));

0 commit comments

Comments
 (0)