Fixed dates.

This commit is contained in:
Samuel Clay 2017-06-07 18:04:34 -07:00
parent f24e61a608
commit d45f8d5dc7
2 changed files with 4 additions and 3 deletions

2
fabfile.py vendored
View file

@ -1479,7 +1479,7 @@ def role_for_host():
@parallel @parallel
def deploy(fast=False, reload=False): def deploy(fast=False, reload=False):
role = role_for_host() role = role_for_host()
if role in ['work', 'search']: if role in ['work', 'search', 'debug']:
deploy_code(copy_assets=False, fast=fast, reload=True) deploy_code(copy_assets=False, fast=fast, reload=True)
else: else:
deploy_code(copy_assets=False, fast=fast, reload=reload) deploy_code(copy_assets=False, fast=fast, reload=reload)

View file

@ -71,7 +71,7 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
}; };
var midnight_tomorrow = function(midnight, days) { var midnight_tomorrow = function(midnight, days) {
if (!days) days = 1; if (!days) days = 1;
return new Date(midnight + days*60*60*24*1000); return new Date(midnight.getTime() + days*60*60*24*1000);
}; };
var midnight_yesterday = function(midnight) { var midnight_yesterday = function(midnight) {
return midnight_tomorrow(midnight, -1); return midnight_tomorrow(midnight, -1);
@ -80,6 +80,7 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
var time = date.format(dateformat == "24" ? "H:i" : "g:ia"); var time = date.format(dateformat == "24" ? "H:i" : "g:ia");
if (date > midnight) { if (date > midnight) {
console.log(['midnight', date, midnight_tomorrow(midnight), date > midnight_tomorrow(midnight)]);
if (date > midnight_tomorrow(midnight)) { if (date > midnight_tomorrow(midnight)) {
if (date < midnight_tomorrow(midnight, 2)) { if (date < midnight_tomorrow(midnight, 2)) {
return "Tomorrow, " + time; return "Tomorrow, " + time;
@ -109,7 +110,7 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
}; };
var midnight_tomorrow = function(midnight, days) { var midnight_tomorrow = function(midnight, days) {
if (!days) days = 1; if (!days) days = 1;
return new Date(midnight + days*60*60*24*1000); return new Date(midnight.getTime() + days*60*60*24*1000);
}; };
var midnight_yesterday = function(midnight) { var midnight_yesterday = function(midnight) {
return midnight_tomorrow(midnight, -1); return midnight_tomorrow(midnight, -1);