Bugzilla – Attachment 118033 Details for
Bug 27835
Closed days offsets with one day
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27835: Fix unit test
Bug-27835-Fix-unit-test.patch (text/plain), 1.59 KB, created by
Nick Clemens
on 2021-03-10 15:58:41 UTC
(
hide
)
Description:
Bug 27835: Fix unit test
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2021-03-10 15:58:41 UTC
Size:
1.59 KB
patch
obsolete
>From ec1d869c4de188fccb6c8d65d99bc3f6709df99b Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 10 Mar 2021 15:51:23 +0000 >Subject: [PATCH] Bug 27835: Fix unit test > >Without this patch the unit tests fail. This highlights a potential issue > >When ignoring holidays we get chargeable units as: >$date_returned->delta_days( $date_due ); > >When excluding holidays: >$calendar->days_between( $date_due, $date_returned ); > >days_between does a loop: >328 while( $start_dt->compare($end_dt) < 1 ) { >329 $delta_days-- if $self->is_holiday($start_dt); >330 $start_dt->add( days => 1 ); >331 } > >Form docs >https://metacpan.org/pod/DateTime#DateTime-%3Ecompare(-$dt1,-$dt2-),-DateTime-%3Ecompare_ignore_floating(-$dt1,-$dt2-) >This method compare two DateTime objects. The semantics are compatible with Perl's sort function; it returns -1 if $dt1 < $dt2, 0 if $dt1 == $dt2, 1 if $dt1 > $dt2. > >So '2000-01-30 00:00:00' compares to itself as '0' and is less than 1 > >Is that correct? Or should the loop use "> -1" >--- > t/db_dependent/Circulation/CalcFine.t | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/t/db_dependent/Circulation/CalcFine.t b/t/db_dependent/Circulation/CalcFine.t >index c56882bc01..be9de756e8 100755 >--- a/t/db_dependent/Circulation/CalcFine.t >+++ b/t/db_dependent/Circulation/CalcFine.t >@@ -88,6 +88,9 @@ subtest 'Test basic functionality' => sub { > year => 2000, > month => 1, > day => 1, >+ hour => 23, >+ minute => 59, >+ second => 59, > ); > > my $end_dt = DateTime->new( >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27835
:
118032
|
118033
|
118288
|
118289
|
118290
|
118319
|
118320
|
118321
|
118322
|
118361
|
118414
|
118415
|
118416
|
118417
|
118418