[Koha-bugs] [Bug 25020] Extending due dates to a specified date should preserve time portion of original due date

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Apr 2 10:23:16 CEST 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25020

--- Comment #6 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
Thanks for the follow-up Tomas.

A quick note, I think this kind of tests is overkill and not needed:

+        Koha::Exceptions::WrongParameter->throw(
+            "'hard_due_date' must be a DateTime object"
+        ) unless $hard_due_date->isa('DateTime');
+
+        $due_date = $hard_due_date->clone->set(
+            hour   => $due_date->hour,
+            minute => $due_date->minute,
+            second => $due_date->second
+        );
+    }
+    else {
+        Koha::Exceptions::WrongParameter->throw(
+            "'days' must be an integer"
+        ) unless looks_like_number($days);
+        $due_date->add( days => $days );

Developers will get an error anyway if $days is not an integer (DateTime will
raise its own meaningful exception), or $hard_due_date is not a DateTime.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list