My question is similar to this one, but I need to process ISO strings.
I've tried to adapt the solution from the other question:
var getNextDay = function(day) {
var date = new Date(day);
date.setDate(date.getDate() + 1);
return date.toISOString().slice(0, 10);
};
This actually works in most cases, e.g. getNextDay('2014-03-31') returns '2014-04-01'.
However, getNextDay('2014-03-30') gives me '2014-03-30' (The full string before slicing is '2014-03-30T23:00:00.000Z')
Does anyone know why this happens and how to solve it?