mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-23 08:15:27 +00:00
Even better date formating
This commit is contained in:
parent
b9dc803e0b
commit
d5ca1259b2
1 changed files with 11 additions and 8 deletions
|
@ -20,17 +20,20 @@ define(
|
||||||
|
|
||||||
var date = Moment(sourceDate);
|
var date = Moment(sourceDate);
|
||||||
|
|
||||||
if (date.isAfter(Moment().add('days', 6))) {
|
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.isAfter(Moment())) {
|
||||||
return date.fromNow(true);
|
return date.fromNow(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (date.isBefore(Moment().add('days', -6))) {
|
|
||||||
return date.fromNow();
|
return date.fromNow();
|
||||||
}
|
|
||||||
|
|
||||||
var calendarDate = date.calendar();
|
|
||||||
//TODO: It would be nice to not have to hack this...
|
|
||||||
return calendarDate.substring(0, calendarDate.indexOf(' at '));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
pad: function(n, width, z) {
|
pad: function(n, width, z) {
|
||||||
|
|
Loading…
Reference in a new issue