[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 Oct 22 16:02:49 CEST 2021


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

Jonathan Druart <jonathan.druart+koha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|In Discussion               |Passed QA

--- Comment #102 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
Tested on top of bug 24609.

This script:
"""
use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Patrons;
use C4::Context;
use C4::Circulation qw(AddIssue );
use t::lib::Mocks;
t::lib::Mocks::mock_config('America/Cordoba');
my $dbh = C4::Context->dbh;
my $patron = Koha::Patron->new({userid => 'xxx', categorycode => 'S',
branchcode => 'CPL'})->store;
t::lib::Mocks::mock_userenv({patron => $patron});
my $item = Koha::Items->find(1);
my $today = dt_from_string;
say "NOW: " . $today. " : " . $today->time_zone_short_name;
my $issue = AddIssue($patron->unblessed, $item->barcode);
my $date_due = $issue->date_due;
say "OBJECT    :" . $date_due;
say "UI        :" . output_pref({str => $date_due});
say "ID: " . $issue->id;
"""

Creates an checkout and outputs:
NOW: 2021-10-22T10:46:15 : -03
OBJECT    :2021-10-27 23:59:00
UI        :10/27/2021 23:59
ID: 4

GET http://kohadev-intra.mydnsname.org:8081/api/v1/checkouts/4
=> "due_date": "2021-10-27T23:59:00-03:00",

PUT http://kohadev-intra.mydnsname.org:8081/api/v1/checkouts/4
{
    "due_date": "2021-10-27T23:59:00-03:00",
    "issuer_id": null,
    "note_seen": false,
    "patron_id": 179,
    "unseen_renewals": 0
}
GET http://kohadev-intra.mydnsname.org:8081/api/v1/checkouts/4
=> "due_date": "2021-10-27T23:59:00-03:00",

PUT http://kohadev-intra.mydnsname.org:8081/api/v1/checkouts/4
{
    "due_date": "2021-10-27T20:59:00-06:00",
    "issuer_id": null,
    "note_seen": false,
    "patron_id": 179,
    "unseen_renewals": 0
}
GET http://kohadev-intra.mydnsname.org:8081/api/v1/checkouts/4
=> "due_date": "2021-10-27T23:59:00-03:00",

PUT http://kohadev-intra.mydnsname.org:8081/api/v1/checkouts/4
{
    "due_date": "2021-10-27T23:59:00-06:00",
    "issuer_id": null,
    "note_seen": false,
    "patron_id": 179,
    "unseen_renewals": 0
}
GET http://kohadev-intra.mydnsname.org:8081/api/v1/checkouts/4
=> "due_date": "2021-10-28T02:59:00-03:00",

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


More information about the Koha-bugs mailing list