Rails 3 jquery date picker date not saving to database

后端 未结 6 1948
独厮守ぢ
独厮守ぢ 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:59

    I ran into the same issue. One solution is to simply change the format that the datepicker uses:

    // in your javascript...
    $j(function(){
      $j("#mile_date").datepicker({
        dateFormat: "yy-mm-dd"
      });
    });
    

    Rails seems to be able to handle the yy-mm-dd format - I'm using that and am having no issues saving the date to the database. The only issue here is that some might find the yy-mm-dd format a little less good looking than mm/dd/yyyy...

提交回复
热议问题