I am using Python's datetime
lib to parse a date and create a datetime object from it.
datetime.datetime.strptime(request.GET['date'], '%d-%m-%Y').date()
This works as long as a valid date is passed. I could use a try
and except
case to handle invalid dates, but would like to return the next valid date, as this is a Django
view
where a redirect would make sense.
How could I solve this?