2021年5月6日星期四

How to pass date into function jQuery without calculate the value?

I want to pass v.planned_start_date exact date as 07-02-2020 to a function, what happen now is the date is minus until getting -2015, like this.. 07 minus 02 minus 2020 = -2015. How to prevent this happen?

var project = '';  $.ajax({      url : url_api,      success: function(response){          $.each(response.data, function(k, v){              console.log(v.planned_start_date); // the value is 07-02-2020              project +=  "<div>"+                              "<input id='chgReqNPSL1"+v.l1_id+"' onchange='chgReqNPSL1(this.id, "+v.planned_start_date+")'>"+                          "</div>";              $("#result").append(project);          });      }  }); // end of ajax      function chgReqNPSL1(id, planned_start_date){      console.log(id); // I got the actual ID no issue here      console.log(planned_start_date); // The problem is here whereby I got -2015 as result not 07-02-2020. Why?  }  
https://stackoverflow.com/questions/67428125/how-to-pass-date-into-function-jquery-without-calculate-the-value May 07, 2021 at 10:06AM

没有评论:

发表评论