summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService.pm
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-05-09 19:47:25 +0200
committermkanat%bugzilla.org <>2009-05-09 19:47:25 +0200
commit502914d29785bf4a4ba6423385979db986c52980 (patch)
tree79208f09f5c8c6f231a21ae9ebd9940e6d9cd392 /Bugzilla/WebService.pm
parente14f0aa2872a93163e55db038ae4e437ef1f5b9e (diff)
downloadbugzilla-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-xBugzilla/WebService.pm15
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__