I'm reformatting date inputs and part of that is using the try/except function to kick out invalid inputs. Part of this requires me to set conditions for what is/is not a valid date. For example, 2017 did not have a leap year, so input '29-02-2017' would be invalid. Another example is '31/09/2010', since September does not have a 31st. Furthermore, '131/09/2020' is also invalid because of the digits in the day. You catch my drift.
A colleague mentioned they created an elaborate list with conditions for each month of the year, but I'm wondering if there is a way to simplify this process.