You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
495 B
22 lines
495 B
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}');
|
|
} |