Skip to content

Commit d632db5

Browse files
committed
Automatic Example Update
1 parent 6abcc6f commit d632db5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ var Calendar = _react2.default.createClass({
162162
exports.default = _react2.default.createClass({
163163
displayName: "DatePicker",
164164
propTypes: {
165+
defaultValue: _react2.default.PropTypes.string,
165166
value: _react2.default.PropTypes.string,
166167
cellPadding: _react2.default.PropTypes.string,
167168
placeholder: _react2.default.PropTypes.string,
@@ -178,7 +179,6 @@ exports.default = _react2.default.createClass({
178179
nextButtonElement: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.object]),
179180
calendarPlacement: _react2.default.PropTypes.string,
180181
dateFormat: _react2.default.PropTypes.string // 'MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY'
181-
182182
},
183183
getDefaultProps: function getDefaultProps() {
184184
var language = typeof window !== "undefined" && window.navigator ? (window.navigator.userLanguage || window.navigator.language || '').toLowerCase() : '';
@@ -198,7 +198,10 @@ exports.default = _react2.default.createClass({
198198
};
199199
},
200200
getInitialState: function getInitialState() {
201-
var state = this.makeDateValues(this.props.value);
201+
if (this.props.value && this.props.defaultValue) {
202+
throw new Error("Conflicting DatePicker properties 'value' and 'defaultValue'");
203+
}
204+
var state = this.makeDateValues(this.props.value || this.props.defaultValue);
202205
if (this.props.weekStartsOnMonday) {
203206
state.dayLabels = this.props.dayLabels.slice(1).concat(this.props.dayLabels.slice(0, 1));
204207
} else {

0 commit comments

Comments
 (0)