The only reliable way to parse a date string is to do it manually, do not rely on Date.parse or passing strings to the Date constructor (which is essentially the same thing).
Before ECMAScript ed 5 (ES5), parsing of strings was entirely implementation dependent. ES5 specified various ISO formats, however there were further changes to parsing with ed 6, so even ISO formats are unreliable and may return local, UTC or NaN dates.
The string "2015-06-29T23:59:59" will be parsed as UTC under ES5, local under ed 6 and before then anything goes (IE8 returns NaN, other browsers from that era may too).
A simple parser, assuming es 6 behaviour and local timezone is:
function parseISO(s) {
var b = s.split(/\D/);
return new Date(b[0], b[1]-1, b[2], b[3], b[4], b[5]);
}
Validating the values and ensuring 2 digit years requires a couple more lines:
function parseISO(s) {
var b = s.split(/\D/);
var d = new Date(b[0], b[1]-1, b[2], b[3], b[4], b[5]);
d.setFullYear(b[0]);
return d && d.getMinutes() == b[4] && d.getMonth() == b[1]-1 && d.getDate() == b[2]? d : new Date(NaN);
}