added datepicker and protection against invalid date inputs