I need to display a date in the text box with the format "dd / mm / YYYY". I tried to include the following in en.yml:
date:
formats:
default: "%d/%m/%Y"
and
<%= f.date_field :date, value: t(:date)%>
But does not work.
I also tried adding a file called date_format.rb to the initializerscode folder :
Date::DATE_FORMATS[:default] = "%d/%m/%Y"
But nothing happens
How can i do this?
Note. I am using Rails 4.
source
share