I'm writing a Python function/class/module/gizmo to convert the following values to YYYY-MM-DD. I'm begrudgingly willing to accept employing the non-standard dateutil to enable easier implementation.
I'm not expecting the stackoverflow community to simply "write this whole thing for me," and I'll probably answer my own question when done. Along the way, any pointers are greatly appreciated. I haven't yet found a Q+A discussion that comprehensively addresses my needs below, but of course I'll be borrowing from those that address portions. eg: "find Monday's" and "timedelta in years" and "six months out".
Additionally: if there's an existing, mature, library (even if it's a non-standard library) that handles some/more/all of this, it might save me significant work. Thanks for any help.
case-insensitive match and conversion of any of the following to YYYY-MM-DD
today
tomorrow
yesterday
monday = next monday
tuesday = next tuesday
wednesday = next wednesday
thursday = next thursday
friday = next friday
saturday = next saturday
sunday = next sunday
-monday = last monday
-tuesday = last tuesday
-wednesday = last wednesday
-thursday = last thursday
-friday = last friday
-saturday = last saturday
-sunday = last sunday
x[d|w|m|y] = 'x' number of days/weeks/months/years in future
-x[d|w|m|y] = 'x' number of days/weeks/months/years in past
examples
1d = 1 day from today
2w = 2 weeks from today
3m = 3 months from today
4y = 4 years from today
-4d = 4 days ago
-3w = 3 weeks ago
-2m = 2 months ago
-1y = 1 year ago
unique truncations of today, tomorrow, yesterday, and
days of week (monday, tuesday) are matched with their
expanded values. eg: 'mo', '-Tues', 'tom', 'yest', 'tod'