1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-21 08:51:43 +02:00
Radarr/NzbDrone.Backbone/Mixins/spoon.js
2013-03-21 15:21:56 -07:00

12 lines
414 B
JavaScript

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';
if (date.isAfter(Date.create('tomorrow')) && date.isBefore(Date.create().addDays(7))) return date.format('{Weekday}');
return date.format('{MM}/{dd}/{yyyy}');
}