Today   (2020-02-02,   at the time of this writing)   happens to be a palindrome,   without the hyphens,   not only for those countries which express their dates in the   yyyy-mm-dd   format but,   unusually,   also for countries which use the   dd-mm-yyyy   format.



Task
Write a program which calculates and shows the next 15 palindromic dates for those countries which express their dates in the   yyyy-mm-dd   format.




require 'date'
 
palindate = Enumerator.new do |yielder|
  ("2020"..).each do |y|
    m, d = y.reverse.scan(/../) # let the Y10K kids handle 5 digit years
    strings = [y, m, d]
    yielder << strings.join("-") if Date.valid_date?( *strings.map( &:to_i ) )
  end
end
 
puts palindate.take(15)