summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard/lib/Queries.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2013-03-22 22:24:09 +0100
committerDave Lawrence <dlawrence@mozilla.com>2013-03-22 22:24:09 +0100
commitddf489ad8abf9e0afa3d4545e784eab7c854bcbe (patch)
tree649afd9c344e95168653179b66432ec35af96a2a /extensions/MyDashboard/lib/Queries.pm
parent2b88ae92c4970f0ff5cccb5b607902f8752590c2 (diff)
downloadbugzilla-ddf489ad8abf9e0afa3d4545e784eab7c854bcbe.tar.gz
bugzilla-ddf489ad8abf9e0afa3d4545e784eab7c854bcbe.tar.xz
Bug 853913 - Some MyDashboard "updated" friendly dates are inappropriate and/or broken w.r.t. timezones
Diffstat (limited to 'extensions/MyDashboard/lib/Queries.pm')
-rw-r--r--extensions/MyDashboard/lib/Queries.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/extensions/MyDashboard/lib/Queries.pm b/extensions/MyDashboard/lib/Queries.pm
index 5a3bf0cc6..7703a29c2 100644
--- a/extensions/MyDashboard/lib/Queries.pm
+++ b/extensions/MyDashboard/lib/Queries.pm
@@ -131,7 +131,8 @@ sub QUERY_DEFS {
sub query_bugs {
my $qdef = shift;
my $dbh = Bugzilla->dbh;
- my $date_now = DateTime->now;
+ my $user = Bugzilla->user;
+ my $date_now = DateTime->now(time_zone => $user->timezone);
## HACK to remove POST
delete $ENV{REQUEST_METHOD};
@@ -149,7 +150,7 @@ sub query_bugs {
foreach my $column (SELECT_COLUMNS) {
$bug->{$column} = shift @$row;
if ($column eq 'changeddate') {
- $bug->{$column} = format_time($bug->{$column}, '%Y-%m-%d %H:%M');
+ $bug->{$column} = format_time($bug->{$column});
my $date_then = datetime_from($bug->{$column});
$bug->{'changeddate_fancy'} = time_ago($date_then, $date_now);
}
@@ -164,7 +165,7 @@ sub query_flags {
my ($type, $include_resolved) = @_;
my $user = Bugzilla->user;
my $dbh = Bugzilla->dbh;
- my $date_now = DateTime->now;
+ my $date_now = DateTime->now(time_zone => $user->timezone);
($type ne 'requestee' || $type ne 'requester')
|| ThrowCodeError('param_required', { param => 'type' });
@@ -244,7 +245,7 @@ sub query_flags {
# Format the updated date specific to the user's timezone and add the fancy version
foreach my $flag (@$flags) {
- $flag->{'updated'} = format_time($flag->{'updated'}, '%Y-%m-%d %H:%M');
+ $flag->{'updated'} = format_time($flag->{'updated'});
my $date_then = datetime_from($flag->{'updated'});
$flag->{'updated_fancy'} = time_ago($date_then, $date_now);
}