You get a string which contains an integer between
99999999 as input. The input string might contain leading zeroes but cannot be longer than 8 characters.
Your goal is to output all dates between
6th of December 1919 and
5th of December 2019 which fit the input in these formats:
- day - month - year (dmy)
- month - day -year (mdy)
- year - month - day (ymd)
Days and months can be either one or two digits. Years can be either two or four digits. Also don't forget the leap years!
Your output dates must be all in the same format (choose one). Its days, months and years must be clearly distinguishable (choose a separator or encode them like YYYYMMDD).
You are free to leave any duplicate dates in your output (you're a good boy if you remove them though). If there are no dates to return, return nothing.
Input: "1234" Output: 1934-02-01, 2012-03-04, 1934-01-02 Input: "01234" Output: 1934-01-02, 1934-02-01 Input: "01211" Output: 2001-11-01, 2011-01-01, 2001-01-11 Input: "30288" Output: 1988-02-03, 1988-02-30, 1988-03-02 Input: "999999" Output:
Shortest code in bytes wins. Have fun!