How to conditionally clear a date field