Skip to content
Browse files

Merge pull request #56 from solidsnack/master

TZ indicators: UTC and ±HH:MM
  • Loading branch information...
2 parents 40c0efa + b2e1c23 commit 0b06fc35ec116d210d8950093934d8b2332d03ad Lee Jarvis committed Jul 27, 2011
Showing with 8 additions and 2 deletions.
  1. +2 −2 lib/chronic/time_zone.rb
  2. +6 −0 test/test_parsing.rb
View
4 lib/chronic/time_zone.rb
@@ -18,8 +18,8 @@ def self.scan(tokens, options)
def self.scan_for_all(token)
scan_for token, self,
{
- /[PMCE][DS]T/i => :tz,
- /(tzminus)?\d{4}/ => :tz
+ /[PMCE][DS]T|UTC/i => :tz,
+ /(tzminus)?\d{2}:?\d{2}/ => :tz
}
end
View
6 test/test_parsing.rb
@@ -109,6 +109,12 @@ def test_handle_rdn_rmn_sd_t_tz_sy
def test_handle_sy_sm_sd_t_tz
time = parse_now("2011-07-03 22:11:35 +0100")
assert_equal 1309727495, time.to_i
+
+ time = parse_now("2011-07-03 22:11:35 +01:00")
+ assert_equal 1309727495, time.to_i
+
+ time = parse_now("2011-07-03 21:11:35 UTC")
+ assert_equal 1309727495, time.to_i
end
def test_handle_rmn_sd_sy

0 comments on commit 0b06fc3

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