Skip to content
Browse files

add support for time strings whose timezone format is (+/-)hhmm

  • Loading branch information...
1 parent 217b8e5 commit 577439915f524907a3756d447f165268bc46a968 @goncalossilva goncalossilva committed with Feb 25, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/psych/scalar_scanner.rb
View
2 lib/psych/scalar_scanner.rb
@@ -90,7 +90,7 @@ def parse_time string
return time if 'Z' == md[3]
return Time.at(time.to_i, us) unless md[3]
- tz = md[3].split(':').map { |digit| Integer(digit, 10) }
+ tz = md[3].match(/^([+\-]?\d{1,2})\:?(\d{1,2})?$/)[1..-1].compact.map { |digit| Integer(digit, 10) }
offset = tz.first * 3600
if offset < 0

0 comments on commit 5774399

Please sign in to comment.
Something went wrong with that request. Please try again.