Hello community,
here is the log from the commit of package perl-DateTime-Format-Natural for
openSUSE:Factory checked in at 2020-05-20 18:45:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-DateTime-Format-Natural (Old)
and /work/SRC/openSUSE:Factory/.perl-DateTime-Format-Natural.new.2738
(New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-DateTime-Format-Natural"
Wed May 20 18:45:42 2020 rev:3 rq:807422 version:1.09
Changes:
--------
---
/work/SRC/openSUSE:Factory/perl-DateTime-Format-Natural/perl-DateTime-Format-Natural.changes
2019-12-09 21:35:32.990090438 +0100
+++
/work/SRC/openSUSE:Factory/.perl-DateTime-Format-Natural.new.2738/perl-DateTime-Format-Natural.changes
2020-05-20 18:46:17.533394188 +0200
@@ -1,0 +2,23 @@
+Mon May 18 03:09:33 UTC 2020 - Tina Müller <[email protected]>
+
+updated to 1.09
+ see /usr/share/doc/packages/perl-DateTime-Format-Natural/Changes
+
+ 1.09 2020-05-17 <[email protected]>
+
+ - Merged development version to stable.
+
+ 1.08_02 2020-05-01 <[email protected]>
+
+ - Require Params::Validate >=1.15 to fix test failures with
+ older versions. [testers #112427415 - Alexandr Ciornii]
+
+ 1.08_01 2020-04-17 <[email protected]>
+
+ - Prefer the future even stronger with demand_future.
+ [rt #92189 - Ricardo Signes]
+
+ - When advancing to future times, consider also minutes/seconds.
+
+
+-------------------------------------------------------------------
Old:
----
DateTime-Format-Natural-1.08.tar.gz
New:
----
DateTime-Format-Natural-1.09.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-DateTime-Format-Natural.spec ++++++
--- /var/tmp/diff_new_pack.9EftOJ/_old 2020-05-20 18:46:18.437396219 +0200
+++ /var/tmp/diff_new_pack.9EftOJ/_new 2020-05-20 18:46:18.441396227 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-DateTime-Format-Natural
#
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,13 +17,13 @@
Name: perl-DateTime-Format-Natural
-Version: 1.08
+Version: 1.09
Release: 0
%define cpan_name DateTime-Format-Natural
Summary: Parse informal natural language date/time strings
License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
-Url: https://metacpan.org/release/%{cpan_name}
+URL: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/S/SC/SCHUBIGER/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildArch: noarch
@@ -36,14 +36,14 @@
BuildRequires: perl(List::MoreUtils)
BuildRequires: perl(Module::Build) >= 0.420000
BuildRequires: perl(Module::Util)
-BuildRequires: perl(Params::Validate)
+BuildRequires: perl(Params::Validate) >= 1.15
BuildRequires: perl(Test::MockTime)
BuildRequires: perl(boolean)
Requires: perl(Clone)
Requires: perl(DateTime)
Requires: perl(DateTime::TimeZone)
Requires: perl(List::MoreUtils)
-Requires: perl(Params::Validate)
+Requires: perl(Params::Validate) >= 1.15
Requires: perl(boolean)
Recommends: perl(Date::Calc)
%{perl_requires}
++++++ DateTime-Format-Natural-1.08.tar.gz ->
DateTime-Format-Natural-1.09.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/Build.PL
new/DateTime-Format-Natural-1.09/Build.PL
--- old/DateTime-Format-Natural-1.08/Build.PL 2019-12-07 21:50:34.000000000
+0100
+++ new/DateTime-Format-Natural-1.09/Build.PL 2020-05-17 17:22:46.000000000
+0200
@@ -19,7 +19,7 @@
'Exporter' => 0,
'Getopt::Long' => 0,
'List::MoreUtils' => 0,
- 'Params::Validate' => 0,
+ 'Params::Validate' => '1.15',
'Scalar::Util' => 0,
'Storable' => 0,
'Term::ReadLine' => 0,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/Changes
new/DateTime-Format-Natural-1.09/Changes
--- old/DateTime-Format-Natural-1.08/Changes 2019-12-07 21:50:34.000000000
+0100
+++ new/DateTime-Format-Natural-1.09/Changes 2020-05-17 17:22:46.000000000
+0200
@@ -1,5 +1,21 @@
Revision history for Perl extension DateTime::Format::Natural.
+1.09 2020-05-17 <[email protected]>
+
+ - Merged development version to stable.
+
+1.08_02 2020-05-01 <[email protected]>
+
+ - Require Params::Validate >=1.15 to fix test failures with
+ older versions. [testers #112427415 - Alexandr Ciornii]
+
+1.08_01 2020-04-17 <[email protected]>
+
+ - Prefer the future even stronger with demand_future.
+ [rt #92189 - Ricardo Signes]
+
+ - When advancing to future times, consider also minutes/seconds.
+
1.08 2019-12-07 <[email protected]>
- Merged development version to stable.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/MANIFEST
new/DateTime-Format-Natural-1.09/MANIFEST
--- old/DateTime-Format-Natural-1.08/MANIFEST 2019-12-07 21:50:34.000000000
+0100
+++ new/DateTime-Format-Natural-1.09/MANIFEST 2020-05-17 17:22:46.000000000
+0200
@@ -28,6 +28,7 @@
t/03-parse_daytime.t
t/04-parse_durations.t
t/05-parse_time_zone.t
+t/06-parse_demand_future.t
t/06-parse_prefer_future.t
t/07-parse_datetime.t
t/07-parse_datetime_future.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/META.json
new/DateTime-Format-Natural-1.09/META.json
--- old/DateTime-Format-Natural-1.08/META.json 2019-12-07 21:50:34.000000000
+0100
+++ new/DateTime-Format-Natural-1.09/META.json 2020-05-17 17:22:46.000000000
+0200
@@ -42,7 +42,7 @@
"Exporter" : "0",
"Getopt::Long" : "0",
"List::MoreUtils" : "0",
- "Params::Validate" : "0",
+ "Params::Validate" : "1.15",
"Scalar::Util" : "0",
"Storable" : "0",
"Term::ReadLine" : "0",
@@ -53,7 +53,7 @@
"provides" : {
"DateTime::Format::Natural" : {
"file" : "lib/DateTime/Format/Natural.pm",
- "version" : "1.08"
+ "version" : "1.09"
},
"DateTime::Format::Natural::Calc" : {
"file" : "lib/DateTime/Format/Natural/Calc.pm",
@@ -93,7 +93,7 @@
},
"DateTime::Format::Natural::Lang::EN" : {
"file" : "lib/DateTime/Format/Natural/Lang/EN.pm",
- "version" : "1.66"
+ "version" : "1.67"
},
"DateTime::Format::Natural::Rewrite" : {
"file" : "lib/DateTime/Format/Natural/Rewrite.pm",
@@ -121,6 +121,6 @@
"url" : "https://github.com/stsc/DateTime-Format-Natural"
}
},
- "version" : "1.08",
+ "version" : "1.09",
"x_serialization_backend" : "JSON::PP version 2.97001"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/META.yml
new/DateTime-Format-Natural-1.09/META.yml
--- old/DateTime-Format-Natural-1.08/META.yml 2019-12-07 21:50:34.000000000
+0100
+++ new/DateTime-Format-Natural-1.09/META.yml 2020-05-17 17:22:46.000000000
+0200
@@ -22,7 +22,7 @@
provides:
DateTime::Format::Natural:
file: lib/DateTime/Format/Natural.pm
- version: '1.08'
+ version: '1.09'
DateTime::Format::Natural::Calc:
file: lib/DateTime/Format/Natural/Calc.pm
version: '1.44'
@@ -52,7 +52,7 @@
version: '1.08'
DateTime::Format::Natural::Lang::EN:
file: lib/DateTime/Format/Natural/Lang/EN.pm
- version: '1.66'
+ version: '1.67'
DateTime::Format::Natural::Rewrite:
file: lib/DateTime/Format/Natural/Rewrite.pm
version: '0.06'
@@ -75,7 +75,7 @@
Exporter: '0'
Getopt::Long: '0'
List::MoreUtils: '0'
- Params::Validate: '0'
+ Params::Validate: '1.15'
Scalar::Util: '0'
Storable: '0'
Term::ReadLine: '0'
@@ -83,5 +83,5 @@
resources:
license: http://dev.perl.org/licenses/
repository: https://github.com/stsc/DateTime-Format-Natural
-version: '1.08'
+version: '1.09'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/Makefile.PL
new/DateTime-Format-Natural-1.09/Makefile.PL
--- old/DateTime-Format-Natural-1.08/Makefile.PL 2019-12-07
21:50:34.000000000 +0100
+++ new/DateTime-Format-Natural-1.09/Makefile.PL 2020-05-17
17:22:46.000000000 +0200
@@ -17,7 +17,7 @@
'Getopt::Long' => 0,
'List::MoreUtils' => 0,
'Module::Util' => 0,
- 'Params::Validate' => 0,
+ 'Params::Validate' => '1.15',
'Scalar::Util' => 0,
'Storable' => 0,
'Term::ReadLine' => 0,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/README
new/DateTime-Format-Natural-1.09/README
--- old/DateTime-Format-Natural-1.08/README 2019-12-07 21:50:34.000000000
+0100
+++ new/DateTime-Format-Natural-1.09/README 2020-05-17 17:22:46.000000000
+0200
@@ -54,7 +54,8 @@
datetime => DateTime->new(...),
lang => 'en',
format => 'mm/dd/yy',
- prefer_future => '[0|1]',
+ prefer_future => [0|1],
+ demand_future => [0|1],
time_zone => 'floating',
daytime => { morning => 06,
afternoon => 13,
@@ -79,6 +80,11 @@
Prefers future time and dates. Accepts a boolean, defaults to false.
+ * "demand_future"
+
+ Demands future time and dates. Similar to "prefer_future", but
+ stronger. Accepts a boolean, defaults to false.
+
* "time_zone"
The time zone to use when parsing and for output. Accepts any time
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.08/lib/DateTime/Format/Natural/Lang/EN.pm
new/DateTime-Format-Natural-1.09/lib/DateTime/Format/Natural/Lang/EN.pm
--- old/DateTime-Format-Natural-1.08/lib/DateTime/Format/Natural/Lang/EN.pm
2019-12-07 21:50:34.000000000 +0100
+++ new/DateTime-Format-Natural-1.09/lib/DateTime/Format/Natural/Lang/EN.pm
2020-05-17 17:22:46.000000000 +0200
@@ -13,7 +13,7 @@
use DateTime::Format::Natural::Helpers qw(%flag);
-our $VERSION = '1.66';
+our $VERSION = '1.67';
our (%init,
%timespan,
@@ -357,7 +357,10 @@
],
[ {} ],
[ '_daytime_variant' ],
- { truncate_to => [q(hour)] },
+ {
+ advance_future => true,
+ truncate_to => [q(hour)],
+ },
],
[
{ 0 => qr/^(afternoon)$/i },
@@ -370,7 +373,10 @@
],
[ {} ],
[ '_daytime_variant' ],
- { truncate_to => [q(hour)] },
+ {
+ advance_future => true,
+ truncate_to => [q(hour)],
+ },
],
[
{ 0 => qr/^(evening)$/i },
@@ -383,7 +389,10 @@
],
[ {} ],
[ '_daytime_variant' ],
- { truncate_to => [q(hour)] },
+ {
+ advance_future => true,
+ truncate_to => [q(hour)],
+ },
]
],
daytime_noon_midnight => [
@@ -399,7 +408,10 @@
],
[ {} ],
[ '_daytime' ],
- { truncate_to => [q(hour)] },
+ {
+ advance_future => true,
+ truncate_to => [q(hour)],
+ },
],
[
{ 0 => qr/^(midnight)$/i },
@@ -412,7 +424,10 @@
],
[ {} ],
[ '_daytime' ],
- { truncate_to => [q(hour)] },
+ {
+ advance_future => true,
+ truncate_to => [q(hour)],
+ },
],
],
daytime_noon_midnight_at => [
@@ -825,8 +840,8 @@
[ {}, {} ],
[ '_weekday', '_daytime_variant' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour)],
+ advance_future => true,
+ truncate_to => [undef, q(hour)],
},
],
[
@@ -844,8 +859,8 @@
[ {}, {} ],
[ '_weekday', '_daytime_variant' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour)],
+ advance_future => true,
+ truncate_to => [undef, q(hour)],
},
],
[
@@ -863,8 +878,8 @@
[ {}, {} ],
[ '_weekday', '_daytime_variant' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour)],
+ advance_future => true,
+ truncate_to => [undef, q(hour)],
},
],
],
@@ -1278,8 +1293,8 @@
[ { unit => 'month' } ],
[ '_unit_date' ],
{
- prefer_future => true,
- truncate_to => [q(month)],
+ advance_future => true,
+ truncate_to => [q(month)],
},
],
],
@@ -1298,8 +1313,8 @@
[ {} ],
[ '_month_day' ],
{
- prefer_future => true,
- truncate_to => [q(day)],
+ advance_future => true,
+ truncate_to => [q(day)],
},
],
[
@@ -1315,8 +1330,8 @@
[ {} ],
[ '_month_day' ],
{
- prefer_future => true,
- truncate_to => [q(day)],
+ advance_future => true,
+ truncate_to => [q(day)],
},
]
],
@@ -1750,8 +1765,8 @@
[ {} ],
[ '_weekday' ],
{
- prefer_future => true,
- truncate_to => [q(day)],
+ advance_future => true,
+ truncate_to => [q(day)],
},
],
],
@@ -2102,8 +2117,8 @@
[ {} ],
[ '_at' ],
{
- prefer_future => true,
- truncate_to => [q(hour_minute)],
+ advance_future => true,
+ truncate_to => [q(hour_minute)],
},
],
[
@@ -2118,8 +2133,8 @@
[ {} ],
[ '_at' ],
{
- prefer_future => true,
- truncate_to => [q(hour_minute)],
+ advance_future => true,
+ truncate_to => [q(hour_minute)],
},
],
],
@@ -2138,8 +2153,8 @@
[ {}, {} ],
[ '_weekday', '_time' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
[
@@ -2157,8 +2172,8 @@
[ {}, {} ],
[ '_weekday', '_at' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
[
@@ -2176,8 +2191,8 @@
[ {}, {} ],
[ '_weekday', '_at' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
[
@@ -2193,8 +2208,8 @@
[ {}, {} ],
[ '_time', '_weekday' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
[
@@ -2212,8 +2227,8 @@
[ {}, {} ],
[ '_at', '_weekday' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
[
@@ -2231,8 +2246,8 @@
[ {}, {} ],
[ '_at', '_weekday' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
],
@@ -2246,8 +2261,8 @@
[ {} ],
[ '_time' ],
{
- prefer_future => true,
- truncate_to => [q(hour_minute)],
+ advance_future => true,
+ truncate_to => [q(hour_minute)],
},
],
],
@@ -4047,8 +4062,8 @@
[ {}, {} ],
[ '_time', '_weekday' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
[
@@ -4066,8 +4081,8 @@
[ {}, {} ],
[ '_at', '_weekday' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
[
@@ -4085,8 +4100,8 @@
[ {}, {} ],
[ '_at', '_weekday' ],
{
- prefer_future => true,
- truncate_to => [undef, q(hour_minute)],
+ advance_future => true,
+ truncate_to => [undef, q(hour_minute)],
},
],
],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.08/lib/DateTime/Format/Natural.pm
new/DateTime-Format-Natural-1.09/lib/DateTime/Format/Natural.pm
--- old/DateTime-Format-Natural-1.08/lib/DateTime/Format/Natural.pm
2019-12-07 21:50:34.000000000 +0100
+++ new/DateTime-Format-Natural-1.09/lib/DateTime/Format/Natural.pm
2020-05-17 17:22:46.000000000 +0200
@@ -21,7 +21,7 @@
use Scalar::Util qw(blessed);
use Storable qw(dclone);
-our $VERSION = '1.08';
+our $VERSION = '1.09';
validation_options(
on_fail => sub
@@ -53,6 +53,7 @@
my %presets = (
lang => 'en',
format => 'd/m/y',
+ demand_future => false,
prefer_future => false,
time_zone => 'floating',
);
@@ -78,6 +79,18 @@
my $self = shift;
validate(@_, {
+ demand_future => {
+ # SCALARREF due to boolean.pm's implementation
+ type => BOOLEAN | SCALARREF,
+ optional => true,
+ callbacks => {
+ 'mutually exclusive' => sub
+ {
+ return true unless exists $_[1]->{prefer_future};
+ die "prefer_future provided\n";
+ },
+ },
+ },
lang => {
type => SCALAR,
optional => true,
@@ -92,6 +105,13 @@
# SCALARREF due to boolean.pm's implementation
type => BOOLEAN | SCALARREF,
optional => true,
+ callbacks => {
+ 'mutually exclusive' => sub
+ {
+ return true unless exists $_[1]->{demand_future};
+ die "demand_future provided\n";
+ },
+ },
},
time_zone => {
type => SCALAR | OBJECT,
@@ -161,7 +181,7 @@
my $dt = $self->_parse_formatted_md($date_string);
return $dt if blessed($dt);
- if ($self->{Prefer_future}) {
+ if ($self->{Prefer_future} || $self->{Demand_future}) {
$self->_advance_future('md');
}
}
@@ -523,8 +543,8 @@
delete $opts{truncate_to};
- if ($self->{Prefer_future} &&
- (exists $opts{prefer_future} && $opts{prefer_future})
+ if (($self->{Prefer_future} || $self->{Demand_future})
+ && (exists $opts{advance_future} && $opts{advance_future})
) {
$self->_advance_future;
}
@@ -552,15 +572,19 @@
? dclone($self->{Datetime})
: DateTime->now(time_zone => $self->{Time_zone});
+ my $day_of_week = sub { $_[0]->_Day_of_Week(map $_[0]->{datetime}->$_,
qw(year month day)) };
+
if ((all { /^(?:second|minute|hour)$/ } keys %modified)
&& (exists $self->{modified}{hour} && $self->{modified}{hour} == 1)
- && $self->{datetime}->hour < $now->hour
+ && (($self->{Prefer_future} && $self->{datetime} < $now)
+ || ($self->{Demand_future} && $self->{datetime} <= $now))
) {
$self->{postprocess}{day} = 1;
}
elsif ($token_contains->('weekdays_all')
&& (exists $self->{modified}{day} && $self->{modified}{day} == 1)
- && ($self->_Day_of_Week(map $self->{datetime}->$_, qw(year month day))
< $now->wday)
+ && (($self->{Prefer_future} && $day_of_week->($self) < $now->wday)
+ || ($self->{Demand_future} && $day_of_week->($self) <= $now->wday))
) {
$self->{postprocess}{day} = 7;
}
@@ -571,7 +595,8 @@
? $self->{modified}{day} == 1
? true : false
: true)
- && ($self->{datetime}->day_of_year < $now->day_of_year)
+ && (($self->{Prefer_future} && $self->{datetime}->day_of_year <
$now->day_of_year)
+ || ($self->{Demand_future} && $self->{datetime}->day_of_year <=
$now->day_of_year))
) {
$self->{postprocess}{year} = 1;
}
@@ -703,7 +728,8 @@
datetime => DateTime->new(...),
lang => 'en',
format => 'mm/dd/yy',
- prefer_future => '[0|1]',
+ prefer_future => [0|1],
+ demand_future => [0|1],
time_zone => 'floating',
daytime => { morning => 06,
afternoon => 13,
@@ -730,6 +756,11 @@
Prefers future time and dates. Accepts a boolean, defaults to false.
+=item * C<demand_future>
+
+Demands future time and dates. Similar to C<prefer_future>, but stronger.
+Accepts a boolean, defaults to false.
+
=item * C<time_zone>
The time zone to use when parsing and for output. Accepts any time zone
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/scripts/dateparse
new/DateTime-Format-Natural-1.09/scripts/dateparse
--- old/DateTime-Format-Natural-1.08/scripts/dateparse 2019-12-07
21:50:34.000000000 +0100
+++ new/DateTime-Format-Natural-1.09/scripts/dateparse 2020-05-17
17:22:46.000000000 +0200
@@ -34,6 +34,7 @@
h|help
l|lang=s
p|prefer_future
+ P|demand_future
s|supported
t|time_zone=s
T|trace
@@ -91,6 +92,7 @@
l => 'lang',
f => 'format',
p => 'prefer_future',
+ P => 'demand_future',
t => 'time_zone',
);
@@ -111,6 +113,7 @@
-h, --help this help screen
-l, --lang=<code> language code
-p, --prefer_future prefer future dates
+ -P, --demand_future demand future dates
-s, --supported list of supported languages
-t, --time_zone=<string> time zone string
-T, --trace print trace after processing
@@ -197,6 +200,7 @@
-h, --help this help screen
-l, --lang=<code> language code
-p, --prefer_future prefer future dates
+ -P, --demand_future demand future dates
-s, --supported list of supported languages
-t, --time_zone=<string> time zone string
-T, --trace print trace after processing
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.08/t/06-parse_demand_future.t
new/DateTime-Format-Natural-1.09/t/06-parse_demand_future.t
--- old/DateTime-Format-Natural-1.08/t/06-parse_demand_future.t 1970-01-01
01:00:00.000000000 +0100
+++ new/DateTime-Format-Natural-1.09/t/06-parse_demand_future.t 2020-05-17
17:22:46.000000000 +0200
@@ -0,0 +1,106 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use boolean qw(true);
+
+use Test::MockTime qw(set_fixed_time);
+use DateTime::Format::Natural;
+use DateTime::Format::Natural::Test ':set';
+use Test::More;
+
+my $date = join '.', map $time{$_}, qw(day month year);
+my $time = join ':', map $time{$_}, qw(hour minute second);
+
+set_fixed_time(
+ "$date $time",
+ '%d.%m.%Y %H:%M:%S',
+);
+
+my @simple = (
+ { 'friday' => '01.12.2006 00:00:00' },
+ { 'monday' => '27.11.2006 00:00:00' },
+ { 'morning' => '24.11.2006 08:00:00' },
+ { 'afternoon' => '24.11.2006 14:00:00' },
+ { 'evening' => '24.11.2006 20:00:00' },
+ { 'thursday morning' => '30.11.2006 08:00:00' },
+ { 'thursday afternoon' => '30.11.2006 14:00:00' },
+ { 'thursday evening' => '30.11.2006 20:00:00' },
+ { 'noon' => '24.11.2006 12:00:00' },
+ { 'midnight' => '25.11.2006 00:00:00' },
+ { 'november' => '01.11.2007 00:00:00' },
+ { 'january' => '01.01.2007 00:00:00' },
+ { 'last january' => '01.01.2005 00:00:00' },
+ { 'next january' => '01.01.2007 00:00:00' },
+ { 'next friday' => '01.12.2006 00:00:00' },
+ { 'last friday' => '17.11.2006 00:00:00' },
+ { '01:13:07' => '25.11.2006 01:13:07' },
+ { '01:13:08' => '25.11.2006 01:13:08' },
+ { '00:30:15' => '25.11.2006 00:30:15' },
+ { '00:00{sec}' => '25.11.2006 00:00:{sec}' },
+ { '12{min_sec}{ }am' => '25.11.2006 00:{min_sec}' },
+ { '12:30{sec}{ }am' => '25.11.2006 00:30:{sec}' },
+ { '4{min_sec}{ }pm' => '24.11.2006 16:{min_sec}' },
+ { '4:20{sec}{ }pm' => '24.11.2006 16:20:{sec}' },
+ { '12:56:06{ }am' => '25.11.2006 00:56:06' },
+ { '12:56:06{ }pm' => '24.11.2006 12:56:06' },
+);
+
+my @combined = (
+ { '4th february' => '04.02.2007 00:00:00' },
+ { 'november 3rd' => '03.11.2007 00:00:00' },
+ { 'sunday {at} 11:00{sec}' => '26.11.2006 11:00:{sec}' },
+ { 'sunday {at} 11:00{sec}{ }am' => '26.11.2006 11:00:{sec}' },
+ { 'sunday {at} 11:00{sec}{ }pm' => '26.11.2006 23:00:{sec}' },
+ { 'monday {at} 8{min_sec}' => '27.11.2006 08:{min_sec}' },
+ { 'monday {at} 8{min_sec}{ }am' => '27.11.2006 08:{min_sec}' },
+ { 'tuesday {at} 8{min_sec}{ }pm' => '28.11.2006 20:{min_sec}' },
+ { 'wednesday {at} 4{min_sec}{ }pm' => '29.11.2006 16:{min_sec}' },
+ { 'friday {at} 03:00{sec}{ }am' => '01.12.2006 03:00:{sec}' },
+ { 'friday {at} 03:00{sec}{ }pm' => '01.12.2006 15:00:{sec}' },
+ { 'monday {at} 03:00{sec}{ }am' => '27.11.2006 03:00:{sec}' },
+ { 'monday {at} 03:00{sec}{ }pm' => '27.11.2006 15:00:{sec}' },
+ { '4:00{sec} thu' => '30.11.2006 04:00:{sec}' },
+ { '4{min_sec}{ }am thu' => '30.11.2006 04:{min_sec}' },
+ { '4{min_sec}{ }pm thu' => '30.11.2006 16:{min_sec}' },
+ { '4:00{sec} on thu' => '30.11.2006 04:00:{sec}' },
+ { '4{min_sec}{ }am on thu' => '30.11.2006 04:{min_sec}' },
+ { '4{min_sec}{ }pm on thu' => '30.11.2006 16:{min_sec}' },
+);
+
+my @formatted = (
+ { '1/3' => '03.01.2007 00:00:00' },
+ { '11/24' => '24.11.2007 00:00:00' },
+ { '12/24' => '24.12.2006 00:00:00' },
+);
+
+_run_tests(172, [ [ \@simple ], [ \@combined ], [ \@formatted ] ], \&compare);
+
+sub compare
+{
+ my $aref = shift;
+
+ foreach my $href (@$aref) {
+ my $key = (keys %$href)[0];
+ foreach my $entry ($time_entries->($key, $href->{$key})) {
+ foreach my $string ($case_strings->($entry->[0])) {
+ compare_strings($string, $entry->[1]);
+ }
+ }
+ }
+}
+
+sub compare_strings
+{
+ my ($string, $result) = @_;
+
+ my $parser = DateTime::Format::Natural->new(demand_future => true);
+ my $dt = $parser->parse_datetime($string);
+
+ if ($parser->success) {
+ is(_result_string($dt), $result, _message($string));
+ }
+ else {
+ fail(_message($string));
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/DateTime-Format-Natural-1.08/t/06-parse_prefer_future.t
new/DateTime-Format-Natural-1.09/t/06-parse_prefer_future.t
--- old/DateTime-Format-Natural-1.08/t/06-parse_prefer_future.t 2019-12-07
21:50:34.000000000 +0100
+++ new/DateTime-Format-Natural-1.09/t/06-parse_prefer_future.t 2020-05-17
17:22:46.000000000 +0200
@@ -20,15 +20,22 @@
my @simple = (
{ 'friday' => '24.11.2006 00:00:00' },
{ 'monday' => '27.11.2006 00:00:00' },
+ { 'morning' => '24.11.2006 08:00:00' },
+ { 'afternoon' => '24.11.2006 14:00:00' },
+ { 'evening' => '24.11.2006 20:00:00' },
{ 'thursday morning' => '30.11.2006 08:00:00' },
{ 'thursday afternoon' => '30.11.2006 14:00:00' },
{ 'thursday evening' => '30.11.2006 20:00:00' },
+ { 'noon' => '24.11.2006 12:00:00' },
+ { 'midnight' => '25.11.2006 00:00:00' },
{ 'november' => '01.11.2007 00:00:00' },
{ 'january' => '01.01.2007 00:00:00' },
{ 'last january' => '01.01.2005 00:00:00' },
{ 'next january' => '01.01.2007 00:00:00' },
{ 'next friday' => '01.12.2006 00:00:00' },
{ 'last friday' => '17.11.2006 00:00:00' },
+ { '01:13:07' => '25.11.2006 01:13:07' },
+ { '01:13:08' => '24.11.2006 01:13:08' },
{ '00:30:15' => '25.11.2006 00:30:15' },
{ '00:00{sec}' => '25.11.2006 00:00:{sec}' },
{ '12{min_sec}{ }am' => '25.11.2006 00:{min_sec}' },
@@ -63,10 +70,11 @@
my @formatted = (
{ '1/3' => '03.01.2007 00:00:00' },
+ { '11/24' => '24.11.2006 00:00:00' },
{ '12/24' => '24.12.2006 00:00:00' },
);
-_run_tests(164, [ [ \@simple ], [ \@combined ], [ \@formatted ] ], \&compare);
+_run_tests(172, [ [ \@simple ], [ \@combined ], [ \@formatted ] ], \&compare);
sub compare
{
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/DateTime-Format-Natural-1.08/t/18-validate.t
new/DateTime-Format-Natural-1.09/t/18-validate.t
--- old/DateTime-Format-Natural-1.08/t/18-validate.t 2019-12-07
21:50:34.000000000 +0100
+++ new/DateTime-Format-Natural-1.09/t/18-validate.t 2020-05-17
17:22:46.000000000 +0200
@@ -7,7 +7,7 @@
use DateTime;
use DateTime::Format::Natural;
use DateTime::TimeZone;
-use Test::More tests => 12;
+use Test::More tests => 17;
eval { DateTime::Format::Natural->new(lang => 'en') };
ok(!$@, 'lang');
@@ -32,6 +32,13 @@
eval { DateTime::Format::Natural->new(prefer_future => $bool->[0]) };
ok(!$@, "prefer_future $bool->[1]");
}
+foreach my $bool (@bools) {
+ eval { DateTime::Format::Natural->new(demand_future => $bool->[0]) };
+ ok(!$@, "demand_future $bool->[1]");
+}
+
+eval { DateTime::Format::Natural->new(prefer_future => true, demand_future =>
true) };
+ok($@ =~ /mutually exclusive/, 'prefer_future/demand_future');
eval { DateTime::Format::Natural->new(time_zone => 'floating') };
ok(!$@, 'time_zone string');