Open Bug 1046168 Opened 10 years ago Updated 10 years ago

Do not call $self->type('dateTime', ...) for fields of type 'date'

Categories

(Bugzilla :: WebService, defect)

4.5.5
defect
Not set
normal

Tracking

()

People

(Reporter: LpSolit, Unassigned)

References

Details

(Keywords: perf)

$self->type('dateTime', $date) calls Bugzilla::WebService::Server->datetime_format_outbound() which calls datetime_from() which calls |new DateTime(\%args)| which cannot do anything useful with your date because a date has no time and no timezone. So it's totally useless and is a perf penalty. For instance, for dates older than 1901-01-01, the time penalty is huge:

datetime_from("1900-12-31") takes 5.74 seconds on my machine! For comparison:
datetime_from("1901-01-01") takes 0.10 second. This is still a lot when you have tens of dates in bugs.

So fields of type 'date', including deadline, shouldn't be formatted using 'dateTime'. Reusing 'string' should do it.
(In reply to Frédéric Buclin from comment #0)
> For instance, for dates older than 1901-01-01, the time penalty is huge

Actually, this is a bug in datetime_from(), see bug 1046213.
You need to log in before you can comment on or make changes to this bug.