saving a string in my db as a date and getting some weird results
if the date is formatted,
dd / mm / yy it will save
if the date is formatted,
mm / dd / yy he will not be able to safely save
in my console if i go
'20/10/2012'.to_date => Sat, 20 Oct 2012
works
if i go
'10/20/2012'.to_date => ArgumentError: invalid date ...
he is breaking
I used the initializer to set the default date format to% m /% d /% Y, which you can see is exactly reflected in my DATE_FORMATS hash.
Date::DATE_FORMATS => {:short=>"%e %b", :long=>"%B %e, %Y", :db=>"%Y-%m-%d", :number=>"%Y%m%d", :long_ordinal=>
It is unclear what is the cause of this problem, as the situation seems to be configured correctly. How to allow?
Thank you!
istan source share