@@ -162,6 +162,7 @@ var Calendar = _react2.default.createClass({
162
162
exports . default = _react2 . default . createClass ( {
163
163
displayName : "DatePicker" ,
164
164
propTypes : {
165
+ defaultValue : _react2 . default . PropTypes . string ,
165
166
value : _react2 . default . PropTypes . string ,
166
167
cellPadding : _react2 . default . PropTypes . string ,
167
168
placeholder : _react2 . default . PropTypes . string ,
@@ -178,7 +179,6 @@ exports.default = _react2.default.createClass({
178
179
nextButtonElement : _react2 . default . PropTypes . oneOfType ( [ _react2 . default . PropTypes . string , _react2 . default . PropTypes . object ] ) ,
179
180
calendarPlacement : _react2 . default . PropTypes . string ,
180
181
dateFormat : _react2 . default . PropTypes . string // 'MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY'
181
-
182
182
} ,
183
183
getDefaultProps : function getDefaultProps ( ) {
184
184
var language = typeof window !== "undefined" && window . navigator ? ( window . navigator . userLanguage || window . navigator . language || '' ) . toLowerCase ( ) : '' ;
@@ -198,7 +198,10 @@ exports.default = _react2.default.createClass({
198
198
} ;
199
199
} ,
200
200
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 ) ;
202
205
if ( this . props . weekStartsOnMonday ) {
203
206
state . dayLabels = this . props . dayLabels . slice ( 1 ) . concat ( this . props . dayLabels . slice ( 0 , 1 ) ) ;
204
207
} else {
0 commit comments