Skip to content

Commit

Permalink
Added updated compiled react-datepicker.js file.
Browse files Browse the repository at this point in the history
  • Loading branch information
maxweber committed Dec 8, 2014
1 parent 22eb832 commit 564d11e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions react-datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ module.exports = Calendar;
var DateUtil = require('./util/date');

var DateInput = React.createClass({displayName: 'DateInput',
getDateFormat: function() {
return this.props.dateFormat != null ? this.props.dateFormat : "YYYY-MM-DD";

getDefaultProps: function() {
return {
dateFormat: 'YYYY-MM-DD'
};
},

getInitialState: function() {
return {
value: this.props.date.format(this.getDateFormat())
value: this.props.date.format(this.props.dateFormat)
};
},

Expand All @@ -125,7 +128,7 @@ var DateInput = React.createClass({displayName: 'DateInput',
this.toggleFocus(newProps.focus);

this.setState({
value: newProps.date.format(this.getDateFormat())
value: newProps.date.format(this.props.dateFormat)
});
},

Expand All @@ -138,7 +141,7 @@ var DateInput = React.createClass({displayName: 'DateInput',
},

handleChange: function(event) {
var date = moment(event.target.value, this.getDateFormat(), true);
var date = moment(event.target.value, this.props.dateFormat, true);

this.setState({
value: event.target.value
Expand All @@ -150,7 +153,7 @@ var DateInput = React.createClass({displayName: 'DateInput',
},

isValueAValidDate: function() {
var date = moment(event.target.value, this.getDateFormat(), true);
var date = moment(event.target.value, this.props.dateFormat, true);

return date.isValid();
},
Expand Down

0 comments on commit 564d11e

Please sign in to comment.