Reputation: 57
I am working on a rails application and have changed the date format displayed across my app to dd.mm.yyyy
using the following code in a file in the config/initializers
directory:
Date::DATE_FORMATS[:default]="%d.%m.%Y"
Time::DATE_FORMATS[:default]="%d.%m.%Y %H:%M"
However, in my forms where I am using the f.date_field
tags, the date display is shown as mm/dd/yyyy
. How can I change the format used there?
Upvotes: 1
Views: 1903
Reputation: 4639
Try this
f.date_field :some_name, value: @some_time.strftime('%d.%m.%Y')
Upvotes: 1