1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-02-01 04:13:42 +00:00
Radarr/UI/Mixins/spoon.js
2013-03-29 16:28:58 -07:00

22 lines
No EOL
495 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}');
}