summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-09 21:24:35 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-09 21:24:35 +0000
commitdafbdd6816f550e1989881ae0c19efd188e932c5 (patch)
treee2b04465ea3cfba9fb9d16efa584bcbd7daf259a
parent07dc8257039f69b41cca50ff49ce738d3df7b362 (diff)
* ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--ext/date/date_parse.c2
-rw-r--r--test/date/test_date_parse.rb9
3 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9cbe6da9bc9..5c4037fcafe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Jul 10 06:22:27 2013 Tadayoshi Funaba <tadf@dotrb.org>
+
+ * ext/date/date_parse.c (date_zone_to_diff): [ruby-core:55831].
+
Wed Jul 10 00:41:42 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (bary_mul): x*1 is x.
diff --git a/ext/date/date_parse.c b/ext/date/date_parse.c
index 815c07f483b..765f9a72925 100644
--- a/ext/date/date_parse.c
+++ b/ext/date/date_parse.c
@@ -569,7 +569,7 @@ date_zone_to_diff(VALUE str)
if (cl >= 3)
min = rb_str_new(&cs[1], 2);
if (cl >= 5)
- min = rb_str_new(&cs[3], 2);
+ sec = rb_str_new(&cs[3], 2);
}
else {
if (cl >= 2)
diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb
index 9e958abaa0c..a3ade3f86b5 100644
--- a/test/date/test_date_parse.rb
+++ b/test/date/test_date_parse.rb
@@ -578,6 +578,15 @@ class TestDateParse < Test::Unit::TestCase
assert_equal(d2, d1)
end
+ def test__parse_odd_offset
+ h = DateTime._parse('2001-02-03T04:05:06+1')
+ assert_equal(3600, h[:offset])
+ h = DateTime._parse('2001-02-03T04:05:06+123')
+ assert_equal(4980, h[:offset])
+ h = DateTime._parse('2001-02-03T04:05:06+12345')
+ assert_equal(5025, h[:offset])
+ end
+
require 'time'
def test_parse__time