From 9a9405da0b6b5baf8157206d34ba3895fb33b788 Mon Sep 17 00:00:00 2001 From: Justin Wood Date: Thu, 4 Mar 2010 14:28:32 -0500 Subject: Bug 545299, XML-RPC WebService should take and return dates and times in UTC. Code part, r+=mkanat --- Bugzilla/WebService/Server/JSONRPC.pm | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'Bugzilla/WebService/Server/JSONRPC.pm') diff --git a/Bugzilla/WebService/Server/JSONRPC.pm b/Bugzilla/WebService/Server/JSONRPC.pm index f929b28ac..d07901a7f 100644 --- a/Bugzilla/WebService/Server/JSONRPC.pm +++ b/Bugzilla/WebService/Server/JSONRPC.pm @@ -27,7 +27,6 @@ use base qw(JSON::RPC::Server::CGI Bugzilla::WebService::Server); use Bugzilla::Error; use Bugzilla::WebService::Constants; use Bugzilla::WebService::Util qw(taint_data); -use Bugzilla::Util qw(datetime_from); sub new { my $class = shift; @@ -77,20 +76,17 @@ sub type { } elsif ($type eq 'dateTime') { # ISO-8601 "YYYYMMDDTHH:MM:SS" with a literal T - $retval = $self->datetime_format($value); + $retval = $self->datetime_format_outbound($value); } # XXX Will have to implement base64 if Bugzilla starts using it. return $retval; } -sub datetime_format { - my ($self, $date_string) = @_; - - # YUI expects ISO8601 in UTC time; uncluding TZ specifier - my $time = datetime_from($date_string, 'UTC'); - my $iso_datetime = $time->iso8601() . 'Z'; - return $iso_datetime; +sub datetime_format_outbound { + my $self = shift; + # YUI expects ISO8601 in UTC time; including TZ specifier + return $self->SUPER::datetime_format_outbound(@_) . 'Z'; } @@ -192,10 +188,10 @@ sub _argument_type_check { my $value = $params->{$field}; if (ref $value eq 'ARRAY') { $params->{$field} = - [ map { $self->_bz_convert_datetime($_) } @$value ]; + [ map { $self->datetime_format_inbound($_) } @$value ]; } else { - $params->{$field} = $self->_bz_convert_datetime($value); + $params->{$field} = $self->datetime_format_inbound($value); } } } @@ -220,14 +216,6 @@ sub _argument_type_check { return $params; } -sub _bz_convert_datetime { - my ($self, $time) = @_; - - my $converted = datetime_from($time, Bugzilla->local_timezone); - $time = $converted->ymd() . ' ' . $converted->hms(); - return $time -} - sub handle_login { my $self = shift; -- cgit v1.2.3-24-g4f1b