Skip to content

Commit

Permalink
Added Cesar Chavez Day as an observed state holiday in California
Browse files Browse the repository at this point in the history
  • Loading branch information
“Evan authored and evansagge committed Mar 19, 2015
1 parent c6757b9 commit d1684b7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions data/us.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ months:
week: 3
regions: [us]
wday: 1
3:
- name: 'Cesar Chavez Day'
regions: [us_ca]
mday: 31
5:
- name: Memorial Day
week: -1
Expand Down Expand Up @@ -83,3 +87,4 @@ tests: |
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
end
assert_equal 'Cesar Chavez Day', (Holidays.on(Date.civil(2008, 3, 31), :us, :us_ca)[0] || {})[:name]
3 changes: 2 additions & 1 deletion lib/holidays/north_america.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :mx, :mx_pue, :us, :us_dc]
[:ca, :ca_qc, :ca_ab, :ca_on, :ca_sk, :ca_mb, :ca_ns, :ca_pe, :ca_bc, :ca_nf, :ca_nt, :ca_nu, :ca_nb, :ca_yk, :mx, :mx_pue, :us, :us_ca, :us_dc]
end

def self.holidays_by_month
Expand Down Expand Up @@ -41,6 +41,7 @@ def self.holidays_by_month
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
{:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
{:mday => 31, :name => "Cesar Chavez Day", :regions => [:us_ca]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
Expand Down
5 changes: 3 additions & 2 deletions lib/holidays/us.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Holidays
# All the definitions are available at https://github.com/alexdunae/holidays
module US # :nodoc:
def self.defined_regions
[:us, :us_dc, :ca]
[:us, :us_dc, :us_ca, :ca]
end

def self.holidays_by_month
Expand All @@ -26,6 +26,8 @@ def self.holidays_by_month
2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
{:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
{:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
3 => [{:mday => 31, :name => "Cesar Chavez Day", :regions => [:us_ca]},
{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
{:wday => 0, :week => 2, :type => :informal, :name => "Mother's Day", :regions => [:us, :ca]},
{:wday => 6, :week => 3, :type => :informal, :name => "Armed Forces Day", :regions => [:us]}],
Expand All @@ -36,7 +38,6 @@ def self.holidays_by_month
11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
{:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
{:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}]
Expand Down
1 change: 1 addition & 0 deletions test/defs/test_defs_north_america.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def test_north_america
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
end
assert_equal 'Cesar Chavez Day', (Holidays.on(Date.civil(2008, 3, 31), :us, :us_ca)[0] || {})[:name]


{Date.civil(2013,2,2) => 'Groundhog Day',
Expand Down
1 change: 1 addition & 0 deletions test/defs/test_defs_us.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def test_us
Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
end
assert_equal 'Cesar Chavez Day', (Holidays.on(Date.civil(2008, 3, 31), :us, :us_ca)[0] || {})[:name]


{Date.civil(2013,2,2) => 'Groundhog Day',
Expand Down

0 comments on commit d1684b7

Please sign in to comment.