Create a Date using the Date type.

This commit fixes an error in Safari that was not working. Moment.JS was not
converting correctly a string, while with thix fix works. More info here:
http://stackoverflow.com/questions/2587345/javascript-date-parse
This commit is contained in:
Daniel Lombraña González 2012-11-13 16:00:15 +01:00
parent 3226d8b11b
commit 7af166ed85

View File

@ -142,7 +142,10 @@ my.Timeline = Backbone.View.extend({
var out = date.trim();
out = out.replace(/(\d)th/g, '$1');
out = out.replace(/(\d)st/g, '$1');
out = out.trim() ? moment(out) : null;
// parse a date in yyyy-mm-dd hh:mm format
var parts = out.match(/(\d+)/g);
out = new Date(parts[0],parts[1]-1,parts[2],parts[3],parts[4]);
out = moment(out);
if (out.toDate() == 'Invalid Date') {
return null;
} else {