Formatting a date input using simple_form

前端 未结 2 1901
时光取名叫无心
时光取名叫无心 2021-01-11 18:51

I have a date type field in my database.

Here\'s the view code I\'m using:

# Using \'as: :string\' to avoid those three dropdowns rails          


        
2条回答
  •  抹茶落季
    2021-01-11 19:09

    Here's what you need :

    f.input :my_date,
            :as => :string, 
            :input_html => { :value => localize(f.object.my_date) }
    

    PS : This was the first link in google search :)

提交回复
热议问题