I am working on a sharepoint 2013 on-premises team site. now i want to set a column which is of type date/time to be equal to today date,so i added a script inside the Edit form, then i tried to set the date value using SPUtiltiy, as follow:-
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
if(dd<10) {
dd = '0'+dd
}
if(mm<10) {
mm = '0'+mm
}
today = dd + '/' + mm + '/' + yyyy;
alert(today);
SPUtility.GetSPFieldByInternalName('OrderDateCustomerApproved_').SetValue(today);
but i got this error:-
Unable to set date, invalid arguments (requires year, month, and day as integers).
throw "Unable to set date, invalid arguments (requires year, month, and day as integers).";
so i tried to do so using pure JavaScript appraoch as follow:-
$('select[id^="OrderDateCustomerApproved_"]').val(today);
where this did not raise any error, but the fielfield was not populated with today date!!
so can anyone adivce on this please?