diff options
author | mkanat%bugzilla.org <> | 2009-05-09 19:47:25 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2009-05-09 19:47:25 +0200 |
commit | 502914d29785bf4a4ba6423385979db986c52980 (patch) | |
tree | 79208f09f5c8c6f231a21ae9ebd9940e6d9cd392 /Bugzilla/WebService.pm | |
parent | e14f0aa2872a93163e55db038ae4e437ef1f5b9e (diff) | |
download | bugzilla-502914d29785bf4a4ba6423385979db986c52980.tar.gz bugzilla-502914d29785bf4a4ba6423385979db986c52980.tar.xz |
Bug 490673: WebServices's datetime_format method was in the wrong module
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> r=wicked, r=ghendricks, a=mkanat
Diffstat (limited to 'Bugzilla/WebService.pm')
-rwxr-xr-x | Bugzilla/WebService.pm | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Bugzilla/WebService.pm b/Bugzilla/WebService.pm index ffaf7c4b7..75fcf6bc9 100755 --- a/Bugzilla/WebService.pm +++ b/Bugzilla/WebService.pm @@ -36,11 +36,24 @@ sub login_exempt { sub type { my ($self, $type, $value) = @_; if ($type eq 'dateTime') { - $value = $self->datetime_format($value); + $value = datetime_format($value); } return XMLRPC::Data->type($type)->value($value); } +sub datetime_format { + my ($date_string) = @_; + + my $time = str2time($date_string); + my ($sec, $min, $hour, $mday, $mon, $year) = localtime $time; + # This format string was stolen from SOAP::Utils->format_datetime, + # which doesn't work but which has almost the right format string. + my $iso_datetime = sprintf('%d%02d%02dT%02d:%02d:%02d', + $year + 1900, $mon + 1, $mday, $hour, $min, $sec); + return $iso_datetime; +} + + 1; __END__ |