I have a date which works fine when using it as English
> Date.strptime("Aug 02, 2015", "%b %d, %Y")
Sun, 02 Aug 2015
However when I use it another language es
, that doesnt work. E.g.
> Date.strptime("ago 02, 2015", "%b %d, %Y")
ArgumentError: invalid date
The text strings ago 02, 2015
itself comes from another service, and I need to standardize it to a particular format such as
> I18n.localize(Date.strptime("Aug 02, 2015", "%b %d, %Y"), format: "%m/%d/%Y")
"08/02/2015"
Is there a way to do this in Ruby, so that
> I18n.localize(Date.strptime("ago 02, 2015", "%b %d, %Y"), format: "%m/%d/%Y")
"08/02/2015"