summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-08-27 09:32:11 +0200
committerlpsolit%gmail.com <>2008-08-27 09:32:11 +0200
commit615cfb88c1aae1f8372b323e9c53a84d8c9146fe (patch)
treed41bf992b9de42c29141e41714b6108866a39204 /Bugzilla/User.pm
parent68c8ee64ec7dc985931f17f98cb83ee153dcd25c (diff)
downloadbugzilla-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.gz
bugzilla-615cfb88c1aae1f8372b323e9c53a84d8c9146fe.tar.xz
Bug 182238: Allow users to choose what time zone to display times in - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index ccee85755..7f59b749c 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -50,6 +50,7 @@ use Bugzilla::Classification;
use Bugzilla::Field;
use Scalar::Util qw(blessed);
+use DateTime::TimeZone;
use base qw(Bugzilla::Object Exporter);
@Bugzilla::User::EXPORT = qw(is_available_username
@@ -349,6 +350,22 @@ sub settings {
return $self->{'settings'};
}
+sub timezone {
+ my $self = shift;
+
+ if (!defined $self->{timezone}) {
+ my $tz = $self->settings->{timezone}->{value};
+ if ($tz eq 'local') {
+ # The user wants the local timezone of the server.
+ $self->{timezone} = Bugzilla->local_timezone;
+ }
+ else {
+ $self->{timezone} = DateTime::TimeZone->new(name => $tz);
+ }
+ }
+ return $self->{timezone};
+}
+
sub flush_queries_cache {
my $self = shift;
@@ -1884,6 +1901,11 @@ value - the value of this setting for this user. Will be the same
is_default - a boolean to indicate whether the user has chosen to make
a preference for themself or use the site default.
+=item C<timezone>
+
+Returns the timezone used to display dates and times to the user,
+as a DateTime::TimeZone object.
+
=item C<groups>
Returns an arrayref of L<Bugzilla::Group> objects representing