dannymcc
dannymcc

Reputation: 3814

Rails date select options?

I have a date_select field in my rails application as follows:

<%= f.date_select :dateinstructed %>

I would like to re-order the drop down lists show they output as:

DD/MM/YYYY

According to what I have read you can use the :order option, but I am unsure how to actually use this option:

<%= f.date_select :dateinstructed, :order = {:day, :month, :year} %>

Obviously this isn't right, but what am I supposed to put in place of the:

:day, :month, :year

Any help would be appreciated!

Thanks,

Danny

Upvotes: 3

Views: 18493

Answers (2)

Prabhakar
Prabhakar

Reputation: 6764

How about this:

  prompt: { day: 'Select day', month: 'Select month', year: 'Select year' }

Upvotes: 0

Samuel Chandra
Samuel Chandra

Reputation: 1185

I think it should be:

<%= f.date_select :dateinstructed, :order => [:day, :month, :year] %>

Hopefully it helps.

Upvotes: 23

Related Questions