Find all possible dates You get a string which contains an integer between 1000 and 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.

Examples:

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!
Ruby, 234 bytes



require'date'
a,b,g=%w(%Y%-m%d %Y%m%d %Y%-m%-d %Y%m%-d %-m%d%Y %m%d%Y %-m%-d%Y %m%-d%Y %d%-m%Y %d%m%Y %-d%-m%Y %-d%m%Y),Date.new(1920)-26,gets
(b..b+36524).map{|d|puts d.to_s if(a+a.map{|x|x.tr(?Y,?y)}).map{|x|d.strftime(x)}.member?g}


Try it online!

I'm willing to bet that this can be shortened this significantly (with regex maybe), but I'm not clever or knowledgable enough to figure that out.

If we are allowed to print the date object itself instead of a string, change puts d.to_s to p d.