js: Don't crash if no date set in a datepicker