finished refactor datepicker