Bug 33029: Add wrapper method for dt_from_string to KohaDates template toolkit plugin
authorKyle Hall <kyle@bywatersolutions.com>
Tue, 21 Feb 2023 17:45:48 +0000 (12:45 -0500)
committerTomas Cohen Arazi <tomascohen@theke.io>
Thu, 6 Jul 2023 15:24:17 +0000 (12:24 -0300)
commit720dec3f4567f5ff7cbc01b7f7bbe52a21b7244d
treea227f3c25216931743006def78faa60aa3f627e4
parent4e1a2f148c91bc2438410f3e71c91f8deb889b91
Bug 33029: Add wrapper method for dt_from_string to KohaDates template toolkit plugin

It would be very useful to have direct access to dt_from_string in our templates. This would allow for us to handle custom date and time formatting. It would, for example, allow us to output the month name for a given date via Template Toolkit easily.

Test Plan:
1) Apply this patch
2) In a notice add '[% Use KohaDates %][% KohaDates.datetime_from_string().ymd %]' to the top of a notice
3) Generate that notice for a patron
4) Note today's date in iso format is rendered at the top of the notice

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Koha/Template/Plugin/KohaDates.pm
t/db_dependent/Letters/TemplateToolkit.t