Add detection for invalid dates