]> git.koha-community.org Git - koha.git/commit
Bug 9031: (QA follow-up) Final changes to Calendar::days_between
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 26 Oct 2017 07:31:50 +0000 (09:31 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 27 Oct 2017 17:09:04 +0000 (14:09 -0300)
commit64899db254375c39bd8e50583861a5e16f4616e8
tree84e0a659e2e67f82bcb4767cd1f5041bfd3ccae9
parentc398cfa37781dd71f0a6eedba0a466f4d6edbee9
Bug 9031: (QA follow-up) Final changes to Calendar::days_between

The crash is caused by comparing two datetimes where one datetime is
floating and the other one was not. In that case the floating is
converted. Note too that DateTime overloads comparison operators.

This patch clones the two dates first. Puts them in floating both. And
just after that starts comparing etc.

Similar small change in hours_between.

Adding a test where the parameters are swapped for days_between.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Calendar.pm
t/db_dependent/Calendar.t