I have to convert a date format to iso format. It works fine but until the date 30. If i use 31/08/2019 it shows range error: Invalid time value at Date.toISOString. Using date picker for this. This error shown for 31 of every month.
function utcDate(element) {
let val = element.val();
let split = val.split(/\//);
var t= split[0]++;
return new Date([split[1], split[0], split[2]].join('/')).toISOString();
}