data = toDate('2015-10-01');
function toDate(dateStr) {
dateStr = dateStr.replace('/', '-');
var parts = dateStr.split("-");
return new Date(parts[2], parts[1] - 1, parts[0]);
}
But the function does not solve the problem if I inserted the date with the formats 01-10-2015 or 01/10/2015.
What solutions do I have? Thank you.