Hello all,
for weeks I have been looking for any code that can help me with this.
I type the date in a text_field in the Brazilian format “dd/mm/yyyy”.
Ok, everything works well, the data is stored in the table, great!
But, naturally, when I call editing, text_fields shows me the date in
ISO format.
There is some way to convert this date before this be shown?
The brazilian_rails plugin does not work in this case.
Check your table and look type data for your date. change it tobe
string, if you dont want change it tobe string, in your view, change to
this code :
[options 1]
<% @registration.date = @registration.date.strftime(‘$d/%m/%Y’)
<%= text_field ‘registration’, ‘date’ %>
[options 2]
<%= text_field ‘registration’, ‘date’, :value=>
@registration.date.strftime(‘$d/%m/%Y’) %>
WHY data value in text_field is in ISO Format, because i am sure your
data type is Date or Time, so that your text_field will so date as like
type data in table not as string that you wish to be shown in Brazillian
format.
Sincerely,
Reinhart
http://teapoci.blogspot.com