Is there an easy way to format the display of a DateTime
value in a Rails view?
For example, if I\'m doing something like:
<%= text_field
In my application_helper.rb I put
def nice_date_form(the_date)
return the_date.strftime('%d-%m-%Y')
end
In any edit.html.erb view file with a jQuery datepicker I then use:
<% if @activity.end_date? %>
<%= f.text_field :end_date, :value => nice_date_form(@activity.end_date) %>
<% else %>
<%= f.text_field :end_date %>
<% end %>