Bug 9211 - days_between wrong behaviour
As noted in comments #15, #16 and #17 of bug 8486, and its API, Koha::Calendar->days_between should always returns a positive number irrespective of the relative order of the parameters. This is still an open bug, which arised when rewriting the Calendar.t file (Bug 9209). Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Paul Poulain <paul.poulain@biblibre.com> Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com> Added Paul's sign-off line, as despite it showing up in Bugzilla, it wasn't on the patch. Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
This commit is contained in:
parent
59b2e0e704
commit
184cc7416a
|
|
@ -241,6 +241,13 @@ sub days_between {
|
|||
my $start_dt = shift;
|
||||
my $end_dt = shift;
|
||||
|
||||
if ( $start_dt->compare($end_dt) > 0 ) {
|
||||
# swap dates
|
||||
my $int_dt = $end_dt;
|
||||
$end_dt = $start_dt;
|
||||
$start_dt = $int_dt;
|
||||
}
|
||||
|
||||
|
||||
# start and end should not be closed days
|
||||
my $days = $start_dt->delta_days($end_dt)->delta_days;
|
||||
|
|
|
|||
Loading…
Reference in New Issue