Rails 3 jquery date picker date not saving to database

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

    j('.jquery-calendar').datepicker().each(function(){
      // convert dates from db to US format
      var $input = j(this)
      var found = $input.val().match(/^(\d{4})-(\d{2})-(\d{2})$/);
      if(found){
        $input.val(found[2]+'/'+found[3]+'/'+found[1]);
      }
    });
    

提交回复
热议问题