update code to workaround some issue of datetimepicker library and support direct input