Fix exception when a certain type of invalid date is passed