As a followup to a question I am trying to help with: javascript date.parse difference in chrome and other browsers
I need assistance in updating the regex I found here:
JavaScript: Which browsers support parsing of ISO-8601 Date String with Date.parse
to handle 2011-11-24T09:00:27+0200
It currently only is supposed to handle the 2011-11-24T09:00:27Z
version of the ISO date
i.e. the rx in
function(s){
var day, tz,
rx= /^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):(\d\d))?$/,
p= rx.exec(s) || [];
if(p[1]){
day= p[1].split(/\D/).map(function(itm){
return parseInt(itm, 10) || 0;
});
day[1]-= 1;
day= new Date(Date.UTC.apply(Date, day));
if(!day.getDate()) return NaN;
if(p[5]){
tz= parseInt(p[5], 10)*60;
if(p[6]) tz += parseInt(p[6], 10);
if(p[4]== "+") tz*= -1;
if(tz) day.setUTCMinutes(day.getUTCMinutes()+ tz);
}
return day;
}
return NaN;
}
to make this fiddle work with IE and Safari
UPDATE: The answers worked. Now I can help others parse the ISO date returned from the facebook API.