Even better date formating

pull/2/head
Mark McDowall 11 years ago
parent b9dc803e0b
commit d5ca1259b2

@ -20,17 +20,20 @@ define(
var date = Moment(sourceDate);
if (date.isAfter(Moment().add('days', 6))) {
return date.fromNow(true);
var calendarDate = date.calendar();
//TODO: It would be nice to not have to hack this...
var strippedCalendarDate = calendarDate.substring(0, calendarDate.indexOf(' at '));
if (strippedCalendarDate){
return strippedCalendarDate;
}
if (date.isBefore(Moment().add('days', -6))) {
return date.fromNow();
if (date.isAfter(Moment())) {
return date.fromNow(true);
}
var calendarDate = date.calendar();
//TODO: It would be nice to not have to hack this...
return calendarDate.substring(0, calendarDate.indexOf(' at '));
return date.fromNow();
},
pad: function(n, width, z) {

Loading…
Cancel
Save