summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/date/date_parse.c2
-rw-r--r--test/date/test_date_parse.rb5
2 files changed, 6 insertions, 1 deletions
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 9511bedf47..95274d5baa 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -980,7 +980,7 @@ parse_iso(VALUE str, VALUE hash)
{
static const char pat_source[] =
#ifndef TIGHT_PARSER
- "('?[-+]?\\d+)-(\\d+)-('?-?\\d+)"
+ "('?[-+]?" NUMBER "+)-(\\d+)-('?-?\\d+)"
#else
BOS
FPW_COM FPT_COM
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index a87b165080..8876104f11 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -590,6 +590,11 @@ class TestDateParse < Test::Unit::TestCase
h = Timeout.timeout(1) {Date._parse(str)}
assert_equal(100_000, Math.log10(h[:year]))
assert_equal(1, h[:mon])
+
+ str = "Jan - 1" + "0" * 100_000
+ h = Timeout.timeout(1) {Date._parse(str)}
+ assert_equal(1, h[:mon])
+ assert_not_include(h, :year)
end
require 'time'