I've been stuck on this for quite a while and would appreciate some help if possible.
Basically I receive a date from an API in the format yyyy-mm-dd. Amongst other things, I wish to display the weekday. Here is the relevant code:
// jsonDate is in the format yyyy-mm-dd
var splitDate = jsonDate.split("-");
var joinedDate = splitDate.join(",");
var myDate = new Date(joinedDate);
var weekday=new Array(7);
weekday[0]="Sun";
weekday[1]="Mon";
weekday[2]="Tue";
weekday[3]="Wed";
weekday[4]="Thu";
weekday[5]="Fri";
weekday[6]="Sat";
var dayOfTheWeek = weekday[myDate.getDay()];
Everything works as it should in Firefox, but in IE8 "dayOfTheWeek" is undefined. IE Developer tools also shows "myDate" as "NaN" when I console log it.
Any help would be really appreciated.