Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merging bc family days

  • Loading branch information...
commit 026d0affa86b0ecf3d451742f0adc621cfddfad6 1 parent d370468
@hahahana hahahana authored
View
6 lib/holidays/ca.rb
@@ -4,7 +4,7 @@ module Holidays
#
# Definitions loaded: data/ca.yaml, data/north_america_informal.yaml
#
- # To use the definitions in this file, load it right after you load the
+ # To use the definitions in this file, load it right after you load the
# Holiday gem:
#
# require 'holidays'
@@ -13,7 +13,7 @@ module Holidays
# All the definitions are available at https://github.com/alexdunae/holidays
module CA # :nodoc:
def self.defined_regions
- [:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_nf, :ca_nt, :ca_nu, :ca_bc, :ca_ns, :ca_yk, :us]
+ [:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_ns, :ca_yk, :us]
end
def self.holidays_by_month
@@ -23,8 +23,8 @@ def self.holidays_by_month
1 => [{:mday => 1, :name => "New Year's Day", :regions => [:ca]},
{:mday => 2, :name => "New Year's", :regions => [:ca_qc]}],
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
- {:wday => 1, :week => 2, :name => "BC Family Day", :regions => [:ca_bc]},
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
+ {:wday => 1, :week => 2, :name => "BC Family Day", :regions => [:ca_bc]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
View
3  lib/holidays/north_america.rb
@@ -13,7 +13,7 @@ module Holidays
# All the definitions are available at https://github.com/alexdunae/holidays
module North_America # :nodoc:
def self.defined_regions
- [:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_nf, :ca_nt, :ca_nu, :ca_bc, :ca_ns, :ca_yk, :mx, :mx_pue, :us, :us_dc]
+ [:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_ns, :ca_yk, :mx, :mx_pue, :us, :us_dc]
end
def self.holidays_by_month
@@ -30,6 +30,7 @@ def self.holidays_by_month
{:function => lambda { |year| Holidays.us_inauguration_day(year) }, :function_id => "us_inauguration_day(year)", :name => "Inauguration Day", :regions => [:us_dc]}],
2 => [{:wday => 1, :week => 3, :name => "Family Day", :regions => [:ca_ab, :ca_on, :ca_sk]},
{:wday => 1, :week => 3, :name => "Louis Riel Day", :regions => [:ca_mb]},
+ {:wday => 1, :week => 2, :name => "BC Family Day", :regions => [:ca_bc]},
{:wday => 1, :week => 1, :name => "Día de la Constitución", :regions => [:mx]},
{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
View
1  test/defs/test_defs_ca.rb
@@ -30,5 +30,6 @@ def test_ca
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
end
+
end
end
View
10 test/defs/test_defs_north_america.rb
@@ -7,8 +7,8 @@
class North_americaDefinitionTests < Test::Unit::TestCase # :nodoc:
def test_north_america
-{Date.civil(2008,1,1) => 'New Year\'s Day',
- Date.civil(2008,3,21) => 'Good Friday',
+{Date.civil(2008,1,1) => 'New Year\'s Day',
+ Date.civil(2008,3,21) => 'Good Friday',
Date.civil(2008,3,24) => 'Easter Monday',
Date.civil(2008,5,19) => 'Victoria Day',
Date.civil(2008,7,1) => 'Canada Day',
@@ -20,12 +20,18 @@ def test_north_america
assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
end
+# Family Day in BC
+[ Date.civil(2013,2,11), Date.civil(2014,2,10) ].each do |date|
+ assert_equal 'BC Family Day', Holidays.on(date, :ca_bc)[0][:name]
+end
+
# Victoria Day
[Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
end
+
{Date.civil(2007,1,1) => 'Año nuevo',
Date.civil(2007,2,5) => 'Día de la Constitución',
Date.civil(2007,5,1) => 'Día del Trabajo',
Please sign in to comment.
Something went wrong with that request. Please try again.