I'm having problems with date string formatting using Javascript. On IE the date format is MM-DD-YYYY but on Firefox it's YYYY-MM-DD. Chrome works both of them but when I choose one of the formats, the other browser gives me an Invalid Date warning.
My code as an example (works on IE but not on Firefox):
var dateSTR = "2015-09-29";
var date = new Date(dateSTR.replace(/(\d{4})-(\d{2})-(\d{2})/,"$2-$3-$1"));
date.setUTCHours(date.getHours());
date.setUTCMinutes(date.getMinutes());
return date.toLocaleDateString();