Hello community,
here is the log from the commit of package perl-DateTime-Format-Natural for
openSUSE:Factory checked in at 2020-09-25 16:35:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-DateTime-Format-Natural (Old)
and /work/SRC/openSUSE:Factory/.perl-DateTime-Format-Natural.new.4249
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-DateTime-Format-Natural"
Fri Sep 25 16:35:23 2020 rev:5 rq:837178 version:1.11
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-DateTime-Format-Natural/perl-DateTime-Format-Natural.changes
2020-06-30 22:25:34.443988920 +0200
+++
/work/SRC/openSUSE:Factory/.perl-DateTime-Format-Natural.new.4249/perl-DateTime-Format-Natural.changes
2020-09-25 16:36:27.236152356 +0200
@@ -1,0 +2,22 @@
+Thu Sep 24 03:07:25 UTC 2020 - Tina Müller <[email protected]>
+
+- updated to 1.11
+ see /usr/share/doc/packages/perl-DateTime-Format-Natural/Changes
+
+ 1.11 2020-09-23 <[email protected]>
+ - Merged development version to stable.
+ 1.10_04 2020-09-22 <[email protected]>
+ - Fail when parsing month/day with an explicit ymd-format.
+ 1.10_03 2020-09-19 <[email protected]>
+ - Clarify meaning of format option.
+ [rt #133200 - Ricardo Signes]
+ 1.10_02 2020-09-05 <[email protected]>
+ - Allow mm/dd and dd/mm as valid formats and amend tests.
+ - Improve format matching regexes.
+ - List example with new format under examples section.
+ 1.10_01 2020-08-21 <[email protected]>
+ - Allow configuration to make "8/10" mean October 8.
+ [rt #133140 - Ricardo Signes]
+ - Minor tweaks.
+
+-------------------------------------------------------------------
Old:
----
DateTime-Format-Natural-1.10.tar.gz
New:
----
DateTime-Format-Natural-1.11.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-DateTime-Format-Natural.spec ++++++
--- /var/tmp/diff_new_pack.0kLReV/_old 2020-09-25 16:36:27.840152892 +0200
+++ /var/tmp/diff_new_pack.0kLReV/_new 2020-09-25 16:36:27.844152895 +0200
@@ -17,7 +17,7 @@
Name: perl-DateTime-Format-Natural
-Version: 1.10
+Version: 1.11
Release: 0
%define cpan_name DateTime-Format-Natural
Summary: Parse informal natural language date/time strings
++++++ DateTime-Format-Natural-1.10.tar.gz ->
DateTime-Format-Natural-1.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.10/Changes
new/DateTime-Format-Natural-1.11/Changes
--- old/DateTime-Format-Natural-1.10/Changes 2020-06-26 20:52:17.000000000
+0200
+++ new/DateTime-Format-Natural-1.11/Changes 2020-09-23 21:29:34.000000000
+0200
@@ -1,5 +1,33 @@
Revision history for Perl extension DateTime::Format::Natural.
+1.11 2020-09-23 <[email protected]>
+
+ - Merged development version to stable.
+
+1.10_04 2020-09-22 <[email protected]>
+
+ - Fail when parsing month/day with an explicit ymd-format.
+
+1.10_03 2020-09-19 <[email protected]>
+
+ - Clarify meaning of format option.
+ [rt #133200 - Ricardo Signes]
+
+1.10_02 2020-09-05 <[email protected]>
+
+ - Allow mm/dd and dd/mm as valid formats and amend tests.
+
+ - Improve format matching regexes.
+
+ - List example with new format under examples section.
+
+1.10_01 2020-08-21 <[email protected]>
+
+ - Allow configuration to make "8/10" mean October 8.
+ [rt #133140 - Ricardo Signes]
+
+ - Minor tweaks.
+
1.10 2020-06-26 <[email protected]>
- Merged development version to stable.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.10/META.json
new/DateTime-Format-Natural-1.11/META.json
--- old/DateTime-Format-Natural-1.10/META.json 2020-06-26 20:52:17.000000000
+0200
+++ new/DateTime-Format-Natural-1.11/META.json 2020-09-23 21:29:34.000000000
+0200
@@ -53,7 +53,7 @@
"provides" : {
"DateTime::Format::Natural" : {
"file" : "lib/DateTime/Format/Natural.pm",
- "version" : "1.10"
+ "version" : "1.11"
},
"DateTime::Format::Natural::Calc" : {
"file" : "lib/DateTime/Format/Natural/Calc.pm",
@@ -81,7 +81,7 @@
},
"DateTime::Format::Natural::Formatted" : {
"file" : "lib/DateTime/Format/Natural/Formatted.pm",
- "version" : "0.07"
+ "version" : "0.10"
},
"DateTime::Format::Natural::Helpers" : {
"file" : "lib/DateTime/Format/Natural/Helpers.pm",
@@ -93,11 +93,11 @@
},
"DateTime::Format::Natural::Lang::EN" : {
"file" : "lib/DateTime/Format/Natural/Lang/EN.pm",
- "version" : "1.68"
+ "version" : "1.69"
},
"DateTime::Format::Natural::Rewrite" : {
"file" : "lib/DateTime/Format/Natural/Rewrite.pm",
- "version" : "0.06"
+ "version" : "0.07"
},
"DateTime::Format::Natural::Test" : {
"file" : "lib/DateTime/Format/Natural/Test.pm",
@@ -121,6 +121,6 @@
"url" : "https://github.com/stsc/DateTime-Format-Natural"
}
},
- "version" : "1.10",
+ "version" : "1.11",
"x_serialization_backend" : "JSON::PP version 2.97001"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.10/META.yml
new/DateTime-Format-Natural-1.11/META.yml
--- old/DateTime-Format-Natural-1.10/META.yml 2020-06-26 20:52:17.000000000
+0200
+++ new/DateTime-Format-Natural-1.11/META.yml 2020-09-23 21:29:34.000000000
+0200
@@ -22,7 +22,7 @@
provides:
DateTime::Format::Natural:
file: lib/DateTime/Format/Natural.pm
- version: '1.10'
+ version: '1.11'
DateTime::Format::Natural::Calc:
file: lib/DateTime/Format/Natural/Calc.pm
version: '1.44'
@@ -43,7 +43,7 @@
version: '0.11'
DateTime::Format::Natural::Formatted:
file: lib/DateTime/Format/Natural/Formatted.pm
- version: '0.07'
+ version: '0.10'
DateTime::Format::Natural::Helpers:
file: lib/DateTime/Format/Natural/Helpers.pm
version: '0.06'
@@ -52,10 +52,10 @@
version: '1.08'
DateTime::Format::Natural::Lang::EN:
file: lib/DateTime/Format/Natural/Lang/EN.pm
- version: '1.68'
+ version: '1.69'
DateTime::Format::Natural::Rewrite:
file: lib/DateTime/Format/Natural/Rewrite.pm
- version: '0.06'
+ version: '0.07'
DateTime::Format::Natural::Test:
file: lib/DateTime/Format/Natural/Test.pm
version: '0.10'
@@ -83,5 +83,5 @@
resources:
license: http://dev.perl.org/licenses/
repository: https://github.com/stsc/DateTime-Format-Natural
-version: '1.10'
+version: '1.11'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.10/README
new/DateTime-Format-Natural-1.11/README
--- old/DateTime-Format-Natural-1.10/README 2020-06-26 20:52:17.000000000
+0200
+++ new/DateTime-Format-Natural-1.11/README 2020-09-23 21:29:34.000000000
+0200
@@ -74,7 +74,27 @@
* "format"
- Specifies the format of numeric dates, defaults to '"d/m/y"'.
+ Specifies the format of numeric dates.
+
+ The format is used to influence how numeric dates are parsed. Given
+ two numbers separated by a slash, the month/day order expected comes
+ from this option. If there is a third number, this option describes
+ where to expect the year. When this format can't be used to
+ interpret the date, some unambiguous dates may be parsed, but there
+ is no form guarantee.
+
+ Current supported "month/day" formats: "dd/mm", "mm/dd".
+
+ Current supported "year/month/day" formats (with slashes):
+ "dd/mm/yy", "dd/mm/yyyy", "mm/dd/yyyy", "yyyy/mm/dd".
+
+ Note that all of the above formats with three units do also parse
+ with dots or dashes as format separators.
+
+ Furthermore, formats can be abbreviated as long as they remain
+ unambiguous.
+
+ Defaults to '"d/m/y"'.
* "prefer_future"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural/Formatted.pm
new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural/Formatted.pm
--- old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural/Formatted.pm
2020-06-26 20:52:17.000000000 +0200
+++ new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural/Formatted.pm
2020-09-23 21:29:34.000000000 +0200
@@ -4,7 +4,7 @@
use warnings;
use boolean qw(true false);
-our $VERSION = '0.07';
+our $VERSION = '0.10';
sub _parse_formatted_ymd
{
@@ -109,7 +109,27 @@
my $date = $self->_split_formatted($date_string);
- my ($month, $day) = split /\//, $date;
+ my @date_chunks = split /\//, $date;
+
+ # This method used to split the date with a format of m/d implicitly
+ # assumed, so provide it if needed to retain backward compatibility.
+ my $format = $self->{Format} =~ m{^[dm]{1,2}/[dm]{1,2}$}i
+ ? do { local $_ = lc $self->{Format}; tr/dm//s; $_ }
+ # XXX hack, remove implicit m/d after 2022-09-22
+ : $self->{format_provided}
+ ? undef
+ : 'm/d';
+
+ unless (defined $format && $format =~ m{^(?:(?:m/d)|(?:d/m))$}) {
+ $self->_set_failure;
+ $self->_set_error("('format' parameter invalid)");
+ return $self->_get_datetime_object;
+ }
+
+ my $i = 0;
+ my %format_index = map { $_ => $i++ } split /\//, $format;
+
+ my ($day, $month) = map $date_chunks[$format_index{$_}], qw(d m);
unless ($self->_check_date($self->{datetime}->year, $month, $day)) {
$self->_set_failure;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural/Lang/EN.pm
new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural/Lang/EN.pm
--- old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural/Lang/EN.pm
2020-06-26 20:52:17.000000000 +0200
+++ new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural/Lang/EN.pm
2020-09-23 21:29:34.000000000 +0200
@@ -13,7 +13,7 @@
use DateTime::Format::Natural::Helpers qw(%flag);
-our $VERSION = '1.68';
+our $VERSION = '1.69';
our (%init,
%timespan,
@@ -4811,6 +4811,8 @@
27/5/1979
1/3
1/3 16:00
+ 3/1
+ 3/1 16:00
4:00
17:00
3:20:00
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural/Rewrite.pm
new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural/Rewrite.pm
--- old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural/Rewrite.pm
2020-06-26 20:52:17.000000000 +0200
+++ new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural/Rewrite.pm
2020-09-23 21:29:34.000000000 +0200
@@ -3,16 +3,17 @@
use strict;
use warnings;
-our $VERSION = '0.06';
+our $VERSION = '0.07';
sub _rewrite
{
my $self = shift;
my ($date_string) = @_;
- $self->_rewrite_regular($date_string);
- $self->_rewrite_aliases($date_string);
- $self->_rewrite_conditional($date_string);
+ foreach my $type (qw(regular aliases conditional)) {
+ my $method = "_rewrite_$type";
+ $self->$method($date_string);
+ }
}
sub _rewrite_regular
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural.pm
new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural.pm
--- old/DateTime-Format-Natural-1.10/lib/DateTime/Format/Natural.pm
2020-06-26 20:52:17.000000000 +0200
+++ new/DateTime-Format-Natural-1.11/lib/DateTime/Format/Natural.pm
2020-09-23 21:29:34.000000000 +0200
@@ -21,7 +21,7 @@
use Scalar::Util qw(blessed);
use Storable qw(dclone);
-our $VERSION = '1.10';
+our $VERSION = '1.11';
validation_options(
on_fail => sub
@@ -68,10 +68,12 @@
$self->{Daytime} = $opts{daytime} || {};
my $mod = join '::', (__PACKAGE__, 'Lang', uc $self->{Lang});
- eval "require $mod"; die $@ if $@;
+ eval "require $mod" or die $@;
$self->{data} = $mod->__new();
$self->{grammar_class} = $mod;
+
+ $self->{format_provided} = exists $opts{format};
}
sub _init_check
@@ -99,7 +101,11 @@
format => {
type => SCALAR,
optional => true,
- regex => qr!^(?:[dmy]{1,4}[-./]){2}[dmy]{1,4}$!i,
+ regex => qr!^(?:
+ (?: (?: [dmy]{1,4}[-./] ){2}[dmy]{1,4} )
+ |
+ (?: [dm]{1,2}/[dm]{1,2} )
+ )$!ix,
},
prefer_future => {
# SCALARREF due to boolean.pm's implementation
@@ -750,7 +756,27 @@
=item * C<format>
-Specifies the format of numeric dates, defaults to 'C<d/m/y>'.
+Specifies the format of numeric dates.
+
+The format is used to influence how numeric dates are parsed. Given two
+numbers separated by a slash, the month/day order expected comes from
+this option. If there is a third number, this option describes where
+to expect the year. When this format can't be used to interpret the
+date, some unambiguous dates may be parsed, but there is no form
+guarantee.
+
+Current supported "month/day" formats: C<dd/mm>, C<mm/dd>.
+
+Current supported "year/month/day" formats (with slashes): C<dd/mm/yy>,
+C<dd/mm/yyyy>, C<mm/dd/yyyy>, C<yyyy/mm/dd>.
+
+Note that all of the above formats with three units do also parse
+with dots or dashes as format separators.
+
+Furthermore, formats can be abbreviated as long as they remain
+unambiguous.
+
+Defaults to 'C<d/m/y>'.
=item * C<prefer_future>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.10/t/02-parse_format.t
new/DateTime-Format-Natural-1.11/t/02-parse_format.t
--- old/DateTime-Format-Natural-1.10/t/02-parse_format.t 2020-06-26
20:52:17.000000000 +0200
+++ new/DateTime-Format-Natural-1.11/t/02-parse_format.t 2020-09-23
21:29:34.000000000 +0200
@@ -17,13 +17,17 @@
{ '31-12-99' => [ '31.12.2099 00:00:00', undef
] },
{ '1/3' => [ '03.01.2006 00:00:00', undef
] },
{ '1/3 {at} 16:00{sec}' => [ '03.01.2006 16:00:{sec}', undef
] },
+ { '8/10' => [ '08.10.2006 00:00:00', 'd/m'
] },
+ { '8/10 {at} 16:00{sec}' => [ '08.10.2006 16:00:{sec}', 'dd/mm'
] },
+ { '8/10' => [ '10.08.2006 00:00:00', 'm/d'
] },
+ { '8/10 {at} 16:00{sec}' => [ '10.08.2006 16:00:{sec}', 'mm/dd'
] },
{ '12/03/2008 {at} 06:56:06{ }am' => [ '12.03.2008 06:56:06', undef
] },
{ '12/03/2008 {at} 06:56:06{ }pm' => [ '12.03.2008 18:56:06', undef
] },
{ '2011-jan-04' => [ '04.01.2011 00:00:00', undef
] },
{ '20111018000000' => [ '18.10.2011 00:00:00', undef
] },
);
-_run_tests(23, [ [ \@specific ] ], \&compare);
+_run_tests(33, [ [ \@specific ] ], \&compare);
sub compare
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.10/t/13-parse_assert.t
new/DateTime-Format-Natural-1.11/t/13-parse_assert.t
--- old/DateTime-Format-Natural-1.10/t/13-parse_assert.t 2020-06-26
20:52:17.000000000 +0200
+++ new/DateTime-Format-Natural-1.11/t/13-parse_assert.t 2020-09-23
21:29:34.000000000 +0200
@@ -5,7 +5,7 @@
use boolean qw(true false);
use DateTime::Format::Natural;
-use Test::More tests => 16;
+use Test::More tests => 17;
{
# Assert for prefixed dates that an extracted unit which is
@@ -108,3 +108,10 @@
my @expressions = $parser->extract_datetime('23:30 some text jan 19th to
20th');
is_deeply(\@expressions, ['23:30', 'jan 19th to 20th'], 'last matching
token in left duration substring');
}
+
+{
+ # Assert that parsing month/day with an explicit ymd-format fails.
+ my $parser = DateTime::Format::Natural->new(format => 'd/m/y');
+ $parser->parse_datetime('8/10');
+ ok(!$parser->success, 'parsing month/day with an explicit ymd-format
failed');
+}