mirror of
https://github.com/viq/NewsBlur.git
synced 2025-08-05 16:49:45 +00:00
Showing 'tomorrow' and future dated stories correctly on the web.
This commit is contained in:
parent
1f0041cff2
commit
991a9a7d72
1 changed files with 14 additions and 2 deletions
|
@ -69,14 +69,26 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
|
|||
midnight.setSeconds(0);
|
||||
return midnight;
|
||||
};
|
||||
var midnight_tomorrow = function(midnight, days) {
|
||||
if (!days) days = 1;
|
||||
return new Date(midnight + days*60*60*24*1000);
|
||||
};
|
||||
var midnight_yesterday = function(midnight) {
|
||||
return new Date(midnight - 60*60*24*1000);
|
||||
return midnight_tomorrow(midnight, -1);
|
||||
};
|
||||
var midnight = midnight_today();
|
||||
var time = date.format(dateformat == "24" ? "H:i" : "g:ia");
|
||||
|
||||
if (date > midnight) {
|
||||
return time;
|
||||
if (date > midnight_tomorrow(midnight)) {
|
||||
if (date < midnight_tomorrow(midnight, 2)) {
|
||||
return "Tomorrow, " + time;
|
||||
} else {
|
||||
return date.format("d M Y, ") + time;
|
||||
}
|
||||
} else {
|
||||
return time;
|
||||
}
|
||||
} else if (date > midnight_yesterday(midnight)) {
|
||||
return "Yesterday, " + time;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue