Bug 33242: Allow passing add_{duration} options to KohaDates
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 16 Mar 2023 08:53:20 +0000 (09:53 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 6 Jun 2023 13:12:16 +0000 (10:12 -0300)
commitc4f78fbdbb9ce0a4818afbb239e5f537d0754897
tree836ca4b19c88a06ddb88586108a0737d0b087cdb
parent0386c14a29e537fe0faeaa7cca0bcbaf43dddcc6
Bug 33242: Allow passing add_{duration} options to KohaDates

For example, if I want to add a few days to the issuedate in a
TT template, I could do this:
    [% checkout.issuedate | $KohaDates add_days => 3 %]

This development allows you to pass add/subtract years, months, weeks,
days, hours, minutes and seconds.

Test plan:
Pick a notice like CHECKOUT.
Add a line like:
    [% checkout.date_due | $KohaDates with_hours => 1, add_minutes => 15 %]
Do a checkout. Verify that the notice generated contains a time that
shifted 15 minutes.
Undo your change.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Template/Plugin/KohaDates.pm