refactor(datepicker): move logic to controller