Date picker options in Rails?

I have a date_select field in my rails application:

<%= f.date_select :dateinstructed %>

I would like to reorder the dropdowns, showing that they are displayed as:

DD/MM/YYYY

According to what I read, you can use the: order option, but I'm not sure how to use this option:

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

Obviously this is wrong, but what should I put in place of:

:day, :month, :year

Any help would be appreciated!

Thank,

Danny

+3
source share
2 answers

I think it should be:

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

Hope this helps.

+21
source

How about this:

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

Source: https://habr.com/ru/post/1746156/


All Articles