The strptime
method processes the text "63" until 2063, not 1963, as you want. This is because the method solves the century using the POSIX standard .
The chronic
gem has a similar problem because it solves the century, albeit in different ways.
The solution is to set the date:
d = Date.strptime("15/10/63","%d/%m/%y") if d > Date.today d = Date.new(d.year - 100, d.month, d.mday) end
In the comments on this post, Stefan offers a nice one liner:
d = d.prev_year(100) if d > Date.today
If you need speed, you can try to optimize as follows:
d <= Date.today || d = d << 1200
source share