Bugzilla – Attachment 128658 Details for
Bug 29718
DateTime - our 'iso' is not ISO 8601
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29718: (QA follow-up) Add optional offset handling
Bug-29718-QA-follow-up-Add-optional-offset-handlin.patch (text/plain), 1.87 KB, created by
Martin Renvoize (ashimema)
on 2021-12-17 12:38:58 UTC
(
hide
)
Description:
Bug 29718: (QA follow-up) Add optional offset handling
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-12-17 12:38:58 UTC
Size:
1.87 KB
patch
obsolete
>From 07f47c961da3359449cf5642134034717c9a1d09 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 17 Dec 2021 12:36:20 +0000 >Subject: [PATCH] Bug 29718: (QA follow-up) Add optional offset handling > >ISO8601 optionally supports timezone offsets. If a timezone is ommited, >we should assume 'local' time (Which in our case is instance >configuration time), if we are passed 'Z' or 'z' we should set timezone >to 'UTC', otherwise we should set the timezone to the passed offset. > >Whilst ISO8601 does NOT support AM/PM, I left that intact as it has >historical relevance in Koha and we share the ISO parsing with SQL type >parsing amongth other things. >--- > Koha/DateUtils.pm | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 57fba31284..0e8bd3c6fc 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -143,7 +143,7 @@ sub dt_from_string { > } > > # Add the faculative time part [hh:mm[:ss]] >- my $time_re .= qr| >+ my $time_re .= qr{ > ( > [Tt]? > \s* >@@ -158,8 +158,11 @@ sub dt_from_string { > \s > (?<ampm>\w{2}) > )? >+ ( >+ (?<utc>[Zz]$)|((?<offset>[\+|\-])(?<hours>[01][0-9]|2[0-3]):(?<minutes>[0-5][0-9])) >+ )? > )? >- |xms; >+ }xms; > $regex .= $time_re unless ( $date_format eq 'rfc3339' ); > $fallback_re .= $time_re; > >@@ -175,6 +178,9 @@ sub dt_from_string { > second => $+{second}, > ); > $ampm = $+{ampm}; >+ if ( $+{utc} ) { >+ $tz = DateTime::TimeZone->new( name => 'UTC' ); >+ } > if ( $+{offset} ) { > # If offset given, set inbound timezone using it. > $tz = DateTime::TimeZone->new( name => $+{offset} . $+{hours} . $+{minutes} ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29718
:
128631
|
128653
|
128654
|
128658
|
128840
|
129372
|
129385
|
129386
|
129387
|
129388
|
129389
|
129390
|
129465
|
129466
|
129467
|
129468
|
129469
|
129470
|
129471