Fixed datepicker, previously broken when adapting from ajackson's code