[Koha-bugs] [Bug 24850] Koha::DateUtils ignores offsets in RFC3339 datetimes

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Apr 17 09:26:36 CEST 2020


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

Marcel de Rooy <m.de.rooy at rijksmuseum.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|BLOCKED                     |Failed QA

--- Comment #40 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
Part of the rfc3339 regex: ([Tt\s])
I am not sure if lowercase t is part of the syntax. I think it should be
capital T or space. Note that \s is more than space. I think we should test for
space only here.

        # Default to UTC (when 'Z' is passed) for inbound timezone.
        $tz = DateTime::TimeZone->new( name => 'UTC' );

Yes, Z stands for UTC. But this line comes out of the blue. We are just
building the regex here.
Further down, we are testing for the offset and at that code location we should
check for the Z too and set UTC timezone.

+    # Convert to configured timezone (unless we started with a dateonly string
or had to drop to floating time)
+    $dt->set_time_zone($server_tz) unless ( $date_only || $floating );

This line is confusing too. Although I am not sure if we have calls in Koha
where a timezone is passed already, so it may be theoretical. But aren't we
effectively ignoring/overriding the $tz parameter here?
Should this routine have a tz parameter anyhow?
Note also that we did not interfere earlier in the code: 
    return DateTime->now( time_zone => $tz )
In line with what we do at the end, we should not allow this return?
So, actually the big question is here: Shouldnt we always return in server
timezone ?

Changing status.

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


More information about the Koha-bugs mailing list