jquery datepicker工作在chrome但在firefox中编辑日期,datepicker格式显示像NaN-NaN-NaN

Am using metronic template for web-application, jquery datepicker working in chrome but in firefox while edit date, the datepicker format show like NaN-NaN-NaN.

My codes are:

$('.edit').on('click', function () {
var date, id = this.id;
   $.getJSON('{{path('getuser')}}?userid=' + id, function (data) {
   $("#user_id").val(id);
   $("#page_type").val('edit');
   $("#empid").val(data['user'][0].EmployeeID);
   $("#empid").attr("disabled", "disabled");
   $("#fname").val(data['user'][0].FirstName);
   $("#lname").val(data['user'][0].LastName);
if (data['user'][0].DOJ) {
var d = new Date(data['user'][0].DOJ);
var day = d.getDate();
var month = d.getMonth() + 1;
var year = d.getFullYear();
if (month < 10) {
   month = "0" + month;
   }
if (day < 10) {
   day = "0" + day;
   }
date = month + "-" + day + "-" + year;
$("#doj").val(date);
   } else {
date = '';
$("#doj").val('');
   }
var arr = data['roles'];
   $.each(arr, function (i, val) {
   $('#my_multi_select1').multiSelect('select', arr[i].RoleID);
     });
var locname = $("select[name=location] option[value='" + data['user'][0].LocationID + "']").text();
   $('#location option').filter(function () {
   return $(this).text() === locname;
   }).prop('selected', true);
   $("#s2id_location > a > .select2-chosen").text(locname);
   $("#uname").val(data['user'][0].UserName);
   $("#email").val(data['user'][0].EmailID);
   $("#password").val(data['user'][0].Password);
   $('#portlet-config').modal('show');
   });
   });

output:

NaN-NaN-NaN

Need solution.

Thanks for advance.

1个回答

I got a solution.

solution is, in database change datetime to date.

展开翻译

译文



我得到了一个解决方案。</ p>

解决方案是,在数据库更改日期时间到目前为止。</ p>
</ div>

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!