Fixed date-parsing logic so that it works on oldIE. Issue #323.

This commit is contained in:
Dan Wilson
2013-05-14 18:18:22 +01:00
parent cf700f4ac0
commit 5122672333
2 changed files with 7 additions and 7 deletions

View File

@@ -134,14 +134,14 @@ my.Timeline = Backbone.View.extend({
if (!date) {
return null;
}
var out = date.trim();
var out = $.trim(date);
out = out.replace(/(\d)th/g, '$1');
out = out.replace(/(\d)st/g, '$1');
out = out.trim() ? moment(out) : null;
if (out.toDate() == 'Invalid Date') {
return null;
} else {
out = $.trim(out) ? moment(out) : null;
if (out && out.isValid()) {
return out.toDate();
} else {
return null;
}
},