Sonarr/UI/Mixins/spoon.js

12 lines
414 B
JavaScript
Raw Normal View History

function bestDateString(sourceDate){
if (!sourceDate) return '';
var date = Date.create(sourceDate);
if (date.isYesterday()) return 'Yesterday';
if (date.isToday()) return 'Today';
if (date.isTomorrow()) return 'Tomorrow';
2013-03-21 03:02:57 +00:00
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) return date.format('{Weekday}');
return date.format('{MM}/{dd}/{yyyy}');
}