[#152,timeline][xs]: handle null or undefined dates properly.
This commit is contained in:
parent
6a746420c6
commit
d2ce46cc42
@ -103,6 +103,9 @@ my.Timeline = Backbone.View.extend({
|
||||
},
|
||||
|
||||
_parseDate: function(date) {
|
||||
if (!date) {
|
||||
return null;
|
||||
}
|
||||
var out = date.trim();
|
||||
out = out.replace(/(\d)th/g, '$1');
|
||||
out = out.replace(/(\d)st/g, '$1');
|
||||
|
||||
@ -59,7 +59,8 @@ test('_parseDate', function () {
|
||||
[ 'August 1st 1914', '1914-08-01T00:00:00.000Z' ],
|
||||
[ '1914-08-01', '1914-08-01T00:00:00.000Z' ],
|
||||
[ '1914-08-01T08:00', '1914-08-01T08:00:00.000Z' ],
|
||||
[ 'afdaf afdaf', null ]
|
||||
[ 'afdaf afdaf', null ],
|
||||
[ null, null ]
|
||||
];
|
||||
_.each(testData, function(item) {
|
||||
var out = view._parseDate(item[0]);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user