When I pass this date string "2015-04-31" to a server script and get date with this function
function stringToDate(s) {
s = s.split(/[-: ]/);
return new Date(s[0], s[1]-1, s[2],0, 0, 0);
}
The date returned is the next day being 2015-05-1.
Why is this happening?