summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Util.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2008-08-28 06:26:13 +0200
committerlpsolit%gmail.com <>2008-08-28 06:26:13 +0200
commit55596ef8c29ae876c718946d54de787f32033db0 (patch)
tree5a09a8373f1e9e268f96caf7ee85e8bf2fee59f4 /Bugzilla/Util.pm
parentef56c491a65eed9dfddb2866c5faa59acb69b0ed (diff)
downloadbugzilla-55596ef8c29ae876c718946d54de787f32033db0.tar.gz
bugzilla-55596ef8c29ae876c718946d54de787f32033db0.tar.xz
Bug 399070: Remove the 'timezone' parameter - Patch by Frédéric Buclin <LpSolit@gmail.com> r/a=mkanat
Diffstat (limited to 'Bugzilla/Util.pm')
-rw-r--r--Bugzilla/Util.pm20
1 files changed, 10 insertions, 10 deletions
diff --git a/Bugzilla/Util.pm b/Bugzilla/Util.pm
index a8c595a05..9ff810b4f 100644
--- a/Bugzilla/Util.pm
+++ b/Bugzilla/Util.pm
@@ -51,6 +51,7 @@ use Bugzilla::Constants;
use Date::Parse;
use Date::Format;
use DateTime;
+use DateTime::TimeZone;
use Text::Wrap;
# This is from the perlsec page, slightly modified to remove a warning
@@ -397,7 +398,7 @@ sub wrap_hard {
}
sub format_time {
- my ($date, $format) = @_;
+ my ($date, $format, $timezone) = @_;
# If $format is undefined, try to guess the correct date format.
if (!defined($format)) {
@@ -429,8 +430,9 @@ sub format_time {
# Use the timezone specified by the server.
time_zone => Bugzilla->local_timezone});
- # Now display the date using the user's timezone.
- $dt->set_time_zone(Bugzilla->user->timezone);
+ # Now display the date using the given timezone,
+ # or the user's timezone if none is given.
+ $dt->set_time_zone($timezone || Bugzilla->user->timezone);
$date = $dt->strftime($format);
}
else {
@@ -875,15 +877,13 @@ A string.
=item C<format_time($time)>
-Takes a time, converts it to the desired format and appends the timezone
-as defined in editparams.cgi, if desired. This routine will be expanded
-in the future to adjust for user preferences regarding what timezone to
-display times in.
+Takes a time and converts it to the desired format and timezone.
+If no format is given, the routine guesses the correct one and returns
+an empty array if it cannot. If no timezone is given, the user's timezone
+is used, as defined in his preferences.
This routine is mainly called from templates to filter dates, see
-"FILTER time" in Templates.pm. In this case, $format is undefined and
-the routine has to "guess" the date format that was passed to $dbh->sql_date_format().
-
+"FILTER time" in L<Bugzilla::Template>.
=item C<format_time_decimal($time)>