Hello community,
here is the log from the commit of package perl-DateTime-Format-Flexible for
openSUSE:Factory checked in at 2019-09-18 13:11:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-DateTime-Format-Flexible (Old)
and /work/SRC/openSUSE:Factory/.perl-DateTime-Format-Flexible.new.7948
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-DateTime-Format-Flexible"
Wed Sep 18 13:11:45 2019 rev:2 rq:731458 version:0.32
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-DateTime-Format-Flexible/perl-DateTime-Format-Flexible.changes
2019-05-06 21:16:38.444977463 +0200
+++
/work/SRC/openSUSE:Factory/.perl-DateTime-Format-Flexible.new.7948/perl-DateTime-Format-Flexible.changes
2019-09-18 13:11:50.452684837 +0200
@@ -1,0 +2,15 @@
+Mon Sep 16 12:12:53 UTC 2019 - <[email protected]>
+
+- updated to 0.32
+ see /usr/share/doc/packages/perl-DateTime-Format-Flexible/Changes
+
+ 0.32 Sat Sep 14 2019
+ - add support for offset timezones without a space separator and formatted
HH:MM '2019-09-03T10:42:00.000-04:00'
+ - thanks Stijn Heymans
+ - allow negative timezone offsets in 2 and 4 digit lengths with and
without spaces
+ - now works: 2007-05-06T04:44:44-0800
+ - now works: 2007-05-06T04:44:44-08
+ - now works: 2007-05-06T04:44:44 -08
+ - validate all timezone offsets
+
+-------------------------------------------------------------------
Old:
----
DateTime-Format-Flexible-0.31.tar.gz
New:
----
DateTime-Format-Flexible-0.32.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-DateTime-Format-Flexible.spec ++++++
--- /var/tmp/diff_new_pack.mLbFv4/_old 2019-09-18 13:11:50.996684723 +0200
+++ /var/tmp/diff_new_pack.mLbFv4/_new 2019-09-18 13:11:51.000684722 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-DateTime-Format-Flexible
#
-# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: perl-DateTime-Format-Flexible
-Version: 0.31
+Version: 0.32
Release: 0
%define cpan_name DateTime-Format-Flexible
Summary: DateTime::Format::Flexible - Flexibly parse strings and turn
them into D[cut]
@@ -57,11 +57,11 @@
%setup -q -n %{cpan_name}-%{version}
%build
-%{__perl} Makefile.PL INSTALLDIRS=vendor
-%{__make} %{?_smp_mflags}
+perl Makefile.PL INSTALLDIRS=vendor
+make %{?_smp_mflags}
%check
-%{__make} test
+make test
%install
%perl_make_install
++++++ DateTime-Format-Flexible-0.31.tar.gz ->
DateTime-Format-Flexible-0.32.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Flexible-0.31/Changes
new/DateTime-Format-Flexible-0.32/Changes
--- old/DateTime-Format-Flexible-0.31/Changes 2018-09-17 10:35:04.000000000
+0200
+++ new/DateTime-Format-Flexible-0.32/Changes 2019-09-14 11:09:37.000000000
+0200
@@ -1,5 +1,14 @@
Revision history for Perl module DateTime::Format::Flexible
+0.32 Sat Sep 14 2019
+ - add support for offset timezones without a space separator and formatted
HH:MM '2019-09-03T10:42:00.000-04:00'
+ - thanks Stijn Heymans
+ - allow negative timezone offsets in 2 and 4 digit lengths with and without
spaces
+ - now works: 2007-05-06T04:44:44-0800
+ - now works: 2007-05-06T04:44:44-08
+ - now works: 2007-05-06T04:44:44 -08
+ - validate all timezone offsets
+
0.31 Mon Sep 17 2018
- add support for Sep 10, 2018 12:58, Sep 10, 18 12:58
- thanks Ian! D. Allen
@@ -46,7 +55,6 @@
- when we have a leading month that is 0 (zero) and we have a year, assume
it is supposed to be october (10)
- thanks Dave Musakhanyan
-
0.26 Tue Apr 22 2014
- support "MM/DD/YYYY HH:MM" (missing seconds),
- support "EEE MMM dd HH:mm:ss z yyyy" (UTC timezone inside string)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Flexible-0.31/META.json
new/DateTime-Format-Flexible-0.32/META.json
--- old/DateTime-Format-Flexible-0.31/META.json 2018-09-17 10:49:46.000000000
+0200
+++ new/DateTime-Format-Flexible-0.32/META.json 2019-09-14 11:44:38.000000000
+0200
@@ -45,6 +45,6 @@
}
},
"release_status" : "stable",
- "version" : "0.31",
+ "version" : "0.32",
"x_serialization_backend" : "JSON::PP version 2.27300_01"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Flexible-0.31/META.yml
new/DateTime-Format-Flexible-0.32/META.yml
--- old/DateTime-Format-Flexible-0.31/META.yml 2018-09-17 10:49:46.000000000
+0200
+++ new/DateTime-Format-Flexible-0.32/META.yml 2019-09-14 11:44:38.000000000
+0200
@@ -27,5 +27,5 @@
DateTime::TimeZone: '0'
List::MoreUtils: '0'
Module::Pluggable: '0'
-version: '0.31'
+version: '0.32'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Flexible-0.31/lib/DateTime/Format/Flexible.pm
new/DateTime-Format-Flexible-0.32/lib/DateTime/Format/Flexible.pm
--- old/DateTime-Format-Flexible-0.31/lib/DateTime/Format/Flexible.pm
2018-09-17 10:35:56.000000000 +0200
+++ new/DateTime-Format-Flexible-0.32/lib/DateTime/Format/Flexible.pm
2019-09-14 11:41:22.000000000 +0200
@@ -2,7 +2,7 @@
use strict;
use warnings;
-our $VERSION = '0.31';
+our $VERSION = '0.32';
use base 'DateTime::Format::Builder';
@@ -614,29 +614,121 @@
}
# set any trailing offset timezones
- if ( my ( $tz ) = $date =~ m{((?:\s+)?\+\d{2,4}|\s+\-\d{4})\.?\z}mx )
- {
- $date =~ s{\Q$tz\E}{};
+ if ( my ( $tz ) = $date =~ m{(
+ (?:\s+)?\+\d{2,4} # ' +04', '+04'
+ |\s+\-\d{4} # ' -0400'
+ |(?:\s+)?[-+]\d{2}:\d{2} # '-04:00',
'+04:00'
+ )\.?\z}mx )
+ {
+ printf( "# possible timezone (%s) in (%s)\n", $tz, $date) if
$ENV{DFF_DEBUG};
+ my $original_tz = $tz;
+ $tz =~ s{:}{};
# some timezones are 2 digit hours, add the minutes part
$tz = _clean_whitespace( $tz );
$tz .= '00' if ( length( $tz ) == 3 );
- $p->{time_zone} = $tz;
- return ( $date , $p );
+ if ( _is_valid_tz_offset( $tz ) )
+ {
+ printf( "# timezone matched (%s)\n" , $tz ) if $ENV{DFF_DEBUG};
+ $date =~ s{\Q$original_tz\E\.?\z}{};
+ $p->{time_zone} = $tz;
+ return ( $date , $p );
+ }
+ }
+
+ if ( length( $date ) > 15 and ($date =~ m{\dT\d} or $date =~ m{\d\s\d}))
+ {
+ # this pattern conflicts with 5-08, 01-02-03, 08-Jan-99, 2006-Dec-08
+ # so we need to check the length and make sure it is long enough to be
+ # a full iso datetime, and that is has a 'T' or ' ' (space) surrounded
by digits
+ if ( my ( $tz ) = $date =~ m{(
+ (?:\s+)?[-+]\d{2,4} # '-0800', '-08',
' -08'
+ )\.?\z}mx )
+ {
+ printf( "# possible timezone (%s) in (%s)\n", $tz, $date) if
$ENV{DFF_DEBUG};
+ my $original_tz = $tz;
+ $tz =~ s{:}{};
+ # some timezones are 2 digit hours, add the minutes part
+ $tz = _clean_whitespace( $tz );
+ $tz .= '00' if ( length( $tz ) == 3 );
+ if ( _is_valid_tz_offset( $tz ) )
+ {
+ $date =~ s{\Q$original_tz\E\.?\z}{};
+ $p->{time_zone} = $tz;
+ return ( $date , $p );
+ }
+ }
}
# search for positive/negative 4 digit timezones that are inside the string
# must be surrounded by spaces
# Mon Apr 05 17:25:35 +0000 2010
- if ( my ( $tz ) = $date =~ m{\s([\+\-]\d{4})\s}mx )
- {
- $date =~ s{\Q$tz\E}{};
- $p->{time_zone} = $tz;
- return ( $date , $p );
+ if ( my ( $tz ) = $date =~ m{\s(
+ [-+]\d{4} # Mon Apr 05 17:25:35
+0000 2010
+ |[-+]\d{2}:\d{2} # Mon Apr 05 17:25:35
+00:00 2010
+ )\s}mx )
+ {
+ my $original_tz = $tz;
+ $tz =~ s{:}{};
+ if ( _is_valid_tz_offset( $tz ) )
+ {
+ $date =~ s{\Q$original_tz\E}{};
+ $p->{time_zone} = $tz;
+ return ( $date , $p );
+ }
}
return ( $date , $p );
}
+sub _is_valid_tz_offset
+{
+ my ($offset) = @_;
+
+ # https://en.wikipedia.org/wiki/List_of_UTC_time_offsets
+ my $valid = {
+ '-1200' => 1,
+ '-1100' => 1,
+ '-1000' => 1,
+ '-0930' => 1,
+ '-0900' => 1,
+ '-0800' => 1,
+ '-0700' => 1,
+ '-0600' => 1,
+ '-0500' => 1,
+ '-0400' => 1,
+ '-0330' => 1,
+ '-0300' => 1,
+ '-0200' => 1,
+ '-0100' => 1,
+ '-0000' => 1,
+ '+0000' => 1,
+ '+0100' => 1,
+ '+0200' => 1,
+ '+0300' => 1,
+ '+0330' => 1,
+ '+0400' => 1,
+ '+0430' => 1,
+ '+0500' => 1,
+ '+0530' => 1,
+ '+0545' => 1,
+ '+0600' => 1,
+ '+0630' => 1,
+ '+0700' => 1,
+ '+0800' => 1,
+ '+0845' => 1,
+ '+0900' => 1,
+ '+0930' => 1,
+ '+1000' => 1,
+ '+1030' => 1,
+ '+1100' => 1,
+ '+1200' => 1,
+ '+1245' => 1,
+ '+1300' => 1,
+ '+1400' => 1,
+ };
+ return exists $valid->{$offset};
+}
+
sub _do_math
{
my ( $string ) = @_;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Flexible-0.31/t/timezones.t
new/DateTime-Format-Flexible-0.32/t/timezones.t
--- old/DateTime-Format-Flexible-0.31/t/timezones.t 2017-03-07
19:12:00.000000000 +0100
+++ new/DateTime-Format-Flexible-0.32/t/timezones.t 2019-09-14
11:10:51.000000000 +0200
@@ -21,7 +21,7 @@
{
my $dt = DateTime::Format::Flexible->parse_datetime( '2009-10-06 GMT.' ,
strip => qr{\.\z} );
is( $dt->datetime , '2009-10-06T00:00:00' , 'GMT. timezone
parsed/stripped' );
- is( $dt->time_zone->name , 'UTC' , 'GMT. timezone set correctly' );
+ is( $dt->time_zone->name , 'UTC' , 'GMT. timezone set correctly to UTC' );
}
{
@@ -30,7 +30,7 @@
is( $dt->time_zone->name , '+0900' , '+09. timezone set correctly' );
}
-foreach my $tz ( DateTime::TimeZone->all_names )
+foreach my $tz ( @TZS )
{
my $dt = DateTime::Format::Flexible->parse_datetime( '2010-01-24T04:58:23
'.$tz );
is( $dt->datetime , '2010-01-24T04:58:23' , "$tz parsed" );
@@ -69,9 +69,39 @@
2010-02-02 12:06:45+09. => 2010-02-02T12:06:45 => +0900
2009-05-21 01:27:48+09. => 2009-05-21T01:27:48 => +0900
2010-08-01 14:25:14+09. => 2010-08-01T14:25:14 => +0900
+2016-08-23 01:56:57-09. => 2016-08-23T01:56:57 => -0900
+2012-04-13 23:33:44-09. => 2012-04-13T23:33:44 => -0900
+2014-02-23 17:48:32-09. => 2014-02-23T17:48:32 => -0900
+2011-06-08 13:00:00-09. => 2011-06-08T13:00:00 => -0900
+2013-09-20 02:25:41-09. => 2013-09-20T02:25:41 => -0900
+2010-01-07 11:42:46-09. => 2010-01-07T11:42:46 => -0900
+2012-01-06 14:00:00-09. => 2012-01-06T14:00:00 => -0900
+2009-07-28 19:04:26-09. => 2009-07-28T19:04:26 => -0900
+2010-03-18 14:00:00-09. => 2010-03-18T14:00:00 => -0900
+2009-11-17 11:27:58-09. => 2009-11-17T11:27:58 => -0900
+2010-02-14 20:42:33-09. => 2010-02-14T20:42:33 => -0900
+2013-04-14 13:00:00-09. => 2013-04-14T13:00:00 => -0900
+2010-02-02 12:06:45-09. => 2010-02-02T12:06:45 => -0900
+2009-05-21 01:27:48-09. => 2009-05-21T01:27:48 => -0900
+2010-08-01 14:25:14-09. => 2010-08-01T14:25:14 => -0900
Mon Apr 05 17:25:35 +0000 2010 => 2010-04-05T17:25:35 => UTC
Mon Apr 05 17:25:35 +0100 2010 => 2010-04-05T17:25:35 => +0100
Mon Apr 05 17:25:35 -0100 2010 => 2010-04-05T17:25:35 => -0100
+Mon Apr 05 17:25:35 +00:00 2010 => 2010-04-05T17:25:35 => UTC
+Mon Apr 05 17:25:35 +01:00 2010 => 2010-04-05T17:25:35 => +0100
+Mon Apr 05 17:25:35 -01:00 2010 => 2010-04-05T17:25:35 => -0100
2010-08-01 14:25:14 +09:00 => 2010-08-01T14:25:14 => +0900
2010-08-01 14:25:14 -06:00 => 2010-08-01T14:25:14 => -0600
00241121 America/Chicago => 0024-11-21T00:00:00 => America/Chicago
+2019-09-03T10:42:00.000-04:00 => 2019-09-03T10:42:00 => -0400
+2019-09-03T10:42:00.000+04:00 => 2019-09-03T10:42:00 => +0400
+2007-05-06T04:44:44-08 => 2007-05-06T04:44:44 => -0800
+2007-05-06T04:44:44-0800 => 2007-05-06T04:44:44 => -0800
+2007-05-06T04:44:44 -08 => 2007-05-06T04:44:44 => -0800
+2007-05-06T04:44:44+08 => 2007-05-06T04:44:44 => +0800
+2007-05-06T04:44:44+0800 => 2007-05-06T04:44:44 => +0800
+2007-05-06T04:44:44 +08 => 2007-05-06T04:44:44 => +0800
+2007-05-06T04:44:44-08:00 => 2007-05-06T04:44:44 => -0800
+2007-05-06T04:44:44+08:00 => 2007-05-06T04:44:44 => +0800
+2007-05-06T04:44:44 -08:00 => 2007-05-06T04:44:44 => -0800
+2007-05-06T04:44:44 +08:00 => 2007-05-06T04:44:44 => +0800