rewrite the datepicker and align logic