summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/psych/scalar_scanner.rb2
-rw-r--r--test/test_scalar_scanner.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/lib/psych/scalar_scanner.rb b/lib/psych/scalar_scanner.rb
index b45d2fc..bee88de 100644
--- a/lib/psych/scalar_scanner.rb
+++ b/lib/psych/scalar_scanner.rb
@@ -50,7 +50,7 @@ module Psych
return time if 'Z' == md[3]
- tz = md[3] ? Integer(md[3].split(':').first) : 0
+ tz = md[3] ? Integer(md[3].split(':').first.sub(/([-+])0/, '\1')) : 0
Time.at((time - (tz * 3600)).to_i, us)
when /^\d{4}-\d{1,2}-\d{1,2}$/
require 'date'
diff --git a/test/test_scalar_scanner.rb b/test/test_scalar_scanner.rb
index 483fa21..eaf6c6e 100644
--- a/test/test_scalar_scanner.rb
+++ b/test/test_scalar_scanner.rb
@@ -6,6 +6,7 @@ class TestScalarScanner < MiniTest::Unit::TestCase
[ '2001-12-15T02:59:43.1Z',
'2001-12-14t21:59:43.10-05:00',
'2001-12-14 21:59:43.10 -5',
+ '2010-01-06 00:00:00 -08:00',
'2001-12-15 2:59:43.10',
].each do |time|
ss = Psych::ScalarScanner.new