Skip to content

Commit

Permalink
some fixes and bug with Chronic... 'today at x' fails. TODO.
Browse files Browse the repository at this point in the history
  • Loading branch information
nofxx committed Jan 16, 2011
1 parent 09ce883 commit cc4a73e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/chronic18n/dics/es_regex.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
es_regex:
!ruby/regexp '/semana qu?e? viene/': next week
!ruby/regexp '/mes qu?e? viene/': next month
!ruby/regexp '/an?ñ?o qu?e? viene/': next year
!ruby/regexp '/an?ñ?o qu?e? viene/': next year
!ruby/regexp '/a las/': at
4 changes: 4 additions & 0 deletions lib/chronic18n/dics/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ pt:
nono: nineth

# Common
hoje: today
agora: now
amanha: tomorrow
amanhã: tomorrow
ontem: yesterday
Expand Down Expand Up @@ -52,6 +54,8 @@ pt:
daqui: in
em: in
após: in
as: at
às: at

# Numbers
um: one
Expand Down
11 changes: 10 additions & 1 deletion spec/chronic18n/pt_spec.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

HOUR = HOURS = 3600
Expand All @@ -18,7 +19,7 @@ def get_time(t)
end

it "should parse hour" do
Chronic18n.parse("em 7 minutos", :pt).min.should eql(Time.now.min + 7)
Chronic18n.parse("em 7 minutos", :pt).min.should eql((Time.now.min + 7) % 60)
end

it "should parse sunday" do
Expand Down Expand Up @@ -46,4 +47,12 @@ def get_time(t)
Chronic18n.parse("daqui 3 semanas", :pt).day.should eql(get_time(21 * DAYS).day)
end

it "should parse month" do
Chronic18n.parse("hoje às 9", :pt).day.should eql(Time.now.day)
end

it "should parse now" do
Chronic18n.parse("agora", :pt).day.should eql(Time.now.day)
end

end

0 comments on commit cc4a73e

Please sign in to comment.