[#135,view/timeline][s]: switch to using momentjs for date parsing.

This commit is contained in:
Rufus Pollock 2012-05-30 23:36:29 +01:00
parent faad3e2329
commit 6f31228520

View File

@ -79,13 +79,16 @@ my.Timeline = Backbone.View.extend({
}
};
this.model.currentDocuments.each(function(doc) {
var tlEntry = {
"startDate": doc.get(self.state.get('startField')),
"endDate": doc.get(self.state.get('endField')) || null,
"headline": String(doc.get(self.model.fields.models[0].id)),
"text": ''
};
if (tlEntry.startDate) {
var start = doc.get(self.state.get('startField'));
if (start) {
var end = moment(doc.get(self.state.get('endField')));
end = end ? end.toDate() : null;
var tlEntry = {
"startDate": moment(start).toDate(),
"endDate": end,
"headline": String(doc.get(self.model.fields.models[0].id)),
"text": ''
};
out.timeline.date.push(tlEntry);
}
});