I use this to get the current date with one month added to it:
var date = new Date(); day = date.getDate(); month = date.getMonth() + 1; month = month + 1; if((String(day)).length == 1) day = '0' + day; if((String(month)).length == 1) month = '0' + month; dateT = day+ '.' + month + '.' + date.getFullYear(); console.log("dateT: " + dateT);
console.log("dateT: " + dateT); I get
I have a method that adds an element to a list on SharePoint.
There I use
var posDeliveryDate = dateT; and then
oListItem.set_item('DeliveryDate', posDeliveryDate);, but I get the error that the String was not recognized as a valid datetime.
I've seen that there are lots of threads regarding this issue, but what do I have to change in my case?
day = date.getDate().toDateString(); but that didn't help and I can't use
Even when I manually enter a date, such as
"14.02.2020" instead of
posDeliveryDate, I get the error.
2 weeks ago the code worked, but now suddenly I get the error