From 1675700073035ace39c0aaae7f9d5f92b8a85e34 Mon Sep 17 00:00:00 2001 From: reality Date: Sat, 31 Aug 2013 12:57:34 +0000 Subject: [PATCH] default timezone --- modules/report/pages.js | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/modules/report/pages.js b/modules/report/pages.js index 70f833e..1397df7 100644 --- a/modules/report/pages.js +++ b/modules/report/pages.js @@ -71,12 +71,11 @@ var pages = function(dbot) { done(); }); }, function() { + var timezone = req.user.timezone || 'Europe/London'; notifications = _.sortBy(notifications, 'time').reverse(); - if(req.user.timezone) { - _.each(notifications, function(v, k) { - v.time = moment(v.time).tz(req.user.timezone); - }); - } + _.each(notifications, function(v, k) { + v.time = moment(v.time).tz(timezone); + }); res.render('notifies', { 'server': req.user.server, @@ -92,12 +91,11 @@ var pages = function(dbot) { user = req.user, notifies = this.pending[user.id]; + var timezone = req.user.timezone || 'Europe/London'; notifies = _.sortBy(notifies, 'time').reverse(); - if(req.user.timezone) { - _.each(notifies, function(v, k) { - v.time = moment(v.time).tz(req.user.timezone); - }); - } + _.each(notifies, function(v, k) { + v.time = moment(v.time).tz(timezone); + }); res.render('missing_notifies', { 'user': user.primaryNick, @@ -136,12 +134,11 @@ var pages = function(dbot) { next(); } }, function() { + var timezone = req.user.timezone || 'Europe/London'; notifies = _.sortBy(notifies, 'time').reverse(); - if(req.user.timezone) { - _.each(notifies, function(v, k) { - v.time = moment(v.time).tz(req.user.timezone); - }); - } + _.each(notifies, function(v, k) { + v.time = moment(v.time).tz(timezone); + }); res.render('notifies', { 'server': server, @@ -159,12 +156,11 @@ var pages = function(dbot) { notify.user = user.primaryNick; notifies.push(notify); }, function() { + var timezone = req.user.timezone || 'Europe/London'; notifies = _.sortBy(notifies, 'time').reverse(); - if(req.user.timezone) { - _.each(notifies, function(v, k) { - v.time = moment(v.time).tz(req.user.timezone); - }); - } + _.each(notifies, function(v, k) { + v.time = moment(v.time).tz(timezone); + }); res.render('notifies', { 'server': server,