Skip to content

Commit

Permalink
adding formating for New Zealand mobile numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
nicday committed May 30, 2013
1 parent b734c47 commit cf56d10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,9 @@

# New Zealand.
#
# TODO Mobile?
#
country '64',
fixed(1) >> split(3,4)
match(/^(2\d)\d+$/) >> split(3,4) | # Mobile
fixed(1) >> split(3,4) # Rest

# Singapore (Republic of).
#
Expand Down
6 changes: 6 additions & 0 deletions spec/lib/phony_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
it 'should format american numbers' do
Phony.format('18705551122').should == '+1 870 555 1122'
end
it 'should format New Zealand 021 mobile numbers' do
Phony.format('64211234567').should == '+64 21 123 4567'
end
it 'should format New Zealand landline numbers' do
Phony.format('6493791234').should == '+64 9 379 1234'
end
end
describe 'international' do
it 'should format north american numbers' do
Expand Down

0 comments on commit cf56d10

Please sign in to comment.