parse_date(text) converting a 'YYYY-MM-DD' string into a datetime.date object using datetime.strptime (then .date()), raising the natural ValueError for malformed input — don't catch it.parse_date('2026-07-28')date(2026, 7, 28)
The format codes %Y-%m-%d match the layout.
datetime.strptime(text, '%Y-%m-%d').
.date() strips the time part.