Calling the function is_holiday on a date truncate that dates because it does a truncate directly on it instead of using a local clone of the date.
Created attachment 13027 [details] [review]
patch to fix the bug and a test
Created attachment 13028 [details] [review]
Patch with a comment in the test to see this bug
Forgot to mention that this is sponsored by CCSR.
Created attachment 13068 [details] [review]
Bug 8966 Koha::Calendar::is_holiday truncates the date
* Create a local copy of the date instead of calling truncate directly on the date
* Add a test to properly test that the issue is fixed
Signed-off-by: Tomas Cohen Arazi <firstname.lastname@example.org>
* thanks for the updated Calendar.t, it helped me understand what the patch was fixing
* small patch, add a test ++
* passes koha-qa.pl
* prove t/Calendar.t => All tests successful.
Patch pushed to master
Pushed to 3.8.x, will be in 3.8.7
I just noticed that the Calendar.t uses a DateTime object with a timezone of Europe/London.
If we change the test to include the following,
my $dt = DateTime->new(
month => 9,
year => 2015,
day => 6,
hour => 12,
minute => 00,
second => 00,
time_zone => 'America/Santiago',
my $calendar = Koha::Calendar->new(branchcode => "MAIN");
We'll get a fatal error with the following message:
Invalid local time for date in time zone: America/Santiago