Added in validity check for dates.