Skip to content
Merged

fix #10

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/react-datetime.cjs.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-datetime.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-datetime.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/react-datetime.umd.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-datetime",
"version": "3.1.0-unc-9",
"version": "3.1.0-unc-10",
"description": "A lightweight but complete datetime picker React.js component",
"homepage": "https://github.com/arqex/react-datetime",
"repository": {
Expand Down
16 changes: 1 addition & 15 deletions src/DateTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,6 @@ export default class Datetime extends React.Component {
viewDate: this.getInitialViewDate( selectedDate ),
selectedDate: selectedDate && selectedDate.isValid() ? selectedDate : undefined,
inputValue: this.getInitialInputValue( selectedDate ),

// inputValueText is the string that is what the user types into the box. It should never
// be modified externally, to prevent issues like the user cursor jumping around, and
// automatically converting a user typed 'A' into 'AM'
inputValueText: this.getInitialInputValue( selectedDate ),
};
}

Expand Down Expand Up @@ -471,15 +466,7 @@ export default class Datetime extends React.Component {
}

if ( thisProps.value && thisProps.value !== prevProps.value ) {
const normalizedPropValue = moment(thisProps.value).toISOString();
const normalizedInputValue = moment(this.state.inputValueText).toISOString();
this.setViewDate( thisProps.value );

if (normalizedPropValue !== normalizedInputValue) {
this.setState({
inputValueText: this.state.inputValue,
});
}
}

this.checkTZ();
Expand Down Expand Up @@ -538,7 +525,7 @@ export default class Datetime extends React.Component {
}

getInputValue() {
return this.state.inputValueText || this.state.inputValue;
return this.state.inputValue;
}

/**
Expand Down Expand Up @@ -597,7 +584,6 @@ export default class Datetime extends React.Component {
else {
update.selectedDate = null;
}
update.inputValueText = value;

this.setState( update, () => {
this.props.onChange( localMoment.isValid() ? localMoment : this.state.inputValue );
Expand Down