From c999e65b806f38ee484ef9850e89f1dc64ec07d4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 12 Nov 2014 17:14:32 +0100 Subject: [PATCH] Bug 13226: 9999-12-31 should not considered as a valid date DateTime::Format::DateParse (called in Koha::DateUtils::dt_from_string) does not manage to parse 9999-12-31 if a time zone is given. my $date = DateTime->new(year => 9999, month => 12, day => 31); => OK DateTime::Format::DateParse->parse_datetime( '9999-12-31' ); => OK DateTime::Format::DateParse->parse_datetime( '9999-12-31', 'America/Los_Angeles' ); => KO (~20sec on my laptop) It should not be considered as a valid date when the letter is parsed. --- C4/Letters.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/Letters.pm b/C4/Letters.pm index 519c0f6..64a83f7 100644 --- a/C4/Letters.pm +++ b/C4/Letters.pm @@ -654,6 +654,7 @@ sub _parseletter { my $replacedby = defined ($val) ? $val : ''; if ( $replacedby and not $replacedby =~ m|0000-00-00| + and not $replacedby =~ m|9999-31-12| and $replacedby =~ m|^\d{4}-\d{2}-\d{2}( \d{2}:\d{2}:\d{2})?$| ) { # If the value is XXXX-YY-ZZ[ AA:BB:CC] we assume it is a date -- 2.1.0