Rails 3 jquery date picker date not saving to database

后端 未结 6 1968
独厮守ぢ
独厮守ぢ 2020-12-31 02:21

When I submit my form I can see the date being sent to in the post. However, It doesn\'t save the date. If I do a date check it says it is not in the proper format. Here

6条回答
  •  余生分开走
    2020-12-31 02:40

    Kinda of hacky but made a helper the set things straight when I know I am giving the server dates in the mm-dd-yy format

    def convert_to_y_m_d(date)
      new_date = date.split("-")[2] + "-" + date.split("-")[0] + "-" + date.split("-")[1]
      new_date
    end
    

提交回复
热议问题