Skip to content

Commit 9509fac

Browse files
JesseChrestlerlayneanderson
authored andcommitted
if isValidDate is passed we need to verify if the view date is valid … (arqex#296)
* if isValidDate is passed we need to verify if the view date is valid before trying to render the component.
1 parent b7c12fd commit 9509fac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

DateTime.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,13 @@ var Datetime = createClass({
192192
}
193193
}
194194
}
195-
195+
//we should only show a valid date if we are provided a isValidDate function.
196+
if (this.props.isValidDate) {
197+
updatedState.viewDate = updatedState.viewDate || this.state.viewDate;
198+
while (!this.props.isValidDate(updatedState.viewDate)) {
199+
updatedState.viewDate = updatedState.viewDate.add(1, 'day');
200+
}
201+
}
196202
this.setState( updatedState );
197203
},
198204

0 commit comments

Comments
 (0)