On 2016-01-13 17:22:59, ilmari wrote:
Show quoted text> After the rewrite in 1.57, parse_datetime no longer accepts traling
> text after the part that matched the pattern.
The attached patch restores the old behaviour.
From e2db597c27aa37e3bb193453b77ce7e41dab74af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?D=2E=20Ilmari=20Manns=C3=A5ker?=
<ilmari.mannsaker@net-a-porter.com>
Date: Wed, 13 Jan 2016 17:47:34 +0000
Subject: [PATCH] Ignore traling text after match
This behaviour was lost in the rewrite, which caused it to only accept
trailing whitespace.
---
Changes | 6 ++++++
lib/DateTime/Format/Strptime.pm | 2 +-
t/edge.t | 8 ++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/Changes b/Changes
index e4fe0eb..48aaf92 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,11 @@
{{$NEXT}}
+[BUG FIXES]
+
+- The behaviour of silently ignoring text after the matching part was
+ lost in the rewrite. This has been restored. Patch by Dagfinn Ilmari
+ Mannsåker. RT #111155.
+
1.62 2015-12-19
[BUG FIXES]
diff --git a/lib/DateTime/Format/Strptime.pm b/lib/DateTime/Format/Strptime.pm
index 88054d2..e2ed0c5 100644
--- a/lib/DateTime/Format/Strptime.pm
+++ b/lib/DateTime/Format/Strptime.pm
@@ -317,7 +317,7 @@ sub _build_parser {
}
return {
- regex => qr/\A\s*$regex\s*\z/,
+ regex => qr/\A\s*$regex/,
fields => \@fields,
};
}
diff --git a/t/edge.t b/t/edge.t
index 5b3708a..ab809d6 100644
--- a/t/edge.t
+++ b/t/edge.t
@@ -52,3 +52,11 @@
year => 2007
month => 8
day => 15
+
+[Trailing text after match]
+%Y-%m-%d
+2016-01-13 in the afternoon
+skip round trip
+year => 2016
+month => 1
+day => 13
--
2.7.0.rc3