Permalink
Browse files

Merge branch 'master' of git://github.com/lee/chronic into lee/master

  • Loading branch information...
mojombo committed Sep 22, 2008
2 parents 715935e + 1acb559 commit 8f501dcbbdd91fbe374300d85fd8b0d34617b0b8
Showing with 6 additions and 0 deletions.
  1. +1 −0 lib/chronic/chronic.rb
  2. +5 −0 test/test_parsing.rb
View
@@ -126,6 +126,7 @@ def pre_normalize(text) #:nodoc:
normalized_text.gsub!(/\b(?:in|during) the (morning)\b/, '\1')
normalized_text.gsub!(/\b(?:in the|during the|at) (afternoon|evening|night)\b/, '\1')
normalized_text.gsub!(/\btonight\b/, 'this night')
+ normalized_text.gsub!(/\b\d+:?\d*[ap]\b/,'\0m')
normalized_text.gsub!(/(\d)([ap]m|oclock)\b/, '\1 \2')
normalized_text.gsub!(/\b(hence|after|from)\b/, 'future')
normalized_text = numericize_ordinals(normalized_text)
View
@@ -642,6 +642,11 @@ def test_am_pm
assert_equal Time.local(2006, 8, 16, 12), parse_now("8/16/2006 at 12pm")
end
+ def test_a_p
+ assert_equal Time.local(2006, 8, 16, 0, 15), parse_now("8/16/2006 at 12:15a")
+ assert_equal Time.local(2006, 8, 16, 18, 30), parse_now("8/16/2006 at 6:30p")
+ end
+
def test_argument_validation
assert_raise(Chronic::InvalidArgumentException) do
time = Chronic.parse("may 27", :foo => :bar)

0 comments on commit 8f501dc

Please sign in to comment.