Refactored some code in SelectDateWidget.