[Koha-bugs] [Bug 29718] New: DateTime - our 'iso' is not ISO 8601

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Dec 16 17:00:38 CET 2021


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

            Bug ID: 29718
           Summary: DateTime - our 'iso' is not ISO 8601
 Change sponsored?: ---
           Product: Koha
           Version: unspecified
          Hardware: All
                OS: All
            Status: In Discussion
          Severity: enhancement
          Priority: P5 - low
         Component: Architecture, internals, and plumbing
          Assignee: koha-bugs at lists.koha-community.org
          Reporter: jonathan.druart+koha at gmail.com
        QA Contact: testopia at bugs.koha-community.org
                CC: martin.renvoize at ptfs-europe.com, tomascohen at gmail.com

In some scripts we are doing unnecessary conversion from string to DT and
vice-versa, sometimes several times.

For instance, see bug 29711. We have epoch => DT => string => sending to
template in 'iso' YYYY-MM-DD HH:MM => DT => string.

This is because the stringified version of DT (the real ISO 8601
YYYY-MM-DDTHH:MM:SS) is not supported by our dt_from_string method.

There are (at least) two options:
* Use DateTime::Format::Strptime

In dt_from_string:
    my $formatter = DateTime::Format::Strptime->new(pattern => '%Y-%m-%d
%H:%M:%S');
    return DateTime->now(
        time_zone => $tz,
        formatter => $formatter,
    ) unless $date_string;

Then later
    $dt_params{formatter} = $formatter;

But that's an overhead for all dt_from_string calls.

* add "T?" to $time_re, easy and efficient.

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


More information about the Koha-bugs mailing list