holidays 1.2.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 858b7ca8ee12adf0ca16bd039b094ac5b396592b
4
- data.tar.gz: 6dea8e8c8abc0ecb1e1983a932aa8877c60544ef
3
+ metadata.gz: 1bc0c740698c7bcfadd4790786cb1608c2376473
4
+ data.tar.gz: 2920fa5efbd181e979856a7d0af8e70cdc253d3d
5
5
  SHA512:
6
- metadata.gz: 9be91c59476aebe6cb91da7ab7c2a7003d0286e2e723c4853f804e62f96b33681bdc2797fe73170dfbd67a659725e2ee34c28717d9da30b0fbc6c523dde90716
7
- data.tar.gz: 51a8a704f91f3966ecba80796a02d3087db3966afa8a59f492a9efe7ef272f2f00bf98154fde2dd4ff1b7149506d9ef198ba01163f211ac69f6bea650d890aa9
6
+ metadata.gz: 9622f1697699f8f9921fb74a5178f809b3f5b0598892d2d3fbb48bf47763cee2152aac30470d0c0c3ab2b917a5069c77f40a0c613be30435abe7fa878525e18c
7
+ data.tar.gz: a18c5423a237e3431bd501fc61b0b2200d440e1d43bcb1093862dfc40a40e196b6101aafa4cd7c681632d95ed55b00cbce6a71d8066e234438a4b1d436cb4770
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Ruby Holidays Gem CHANGELOG
2
2
 
3
+ ## 2.0.0
4
+
5
+ * Add test coverage
6
+ * Remove support for Ruby 1.8.7 and REE. (https://github.com/itsmechlark)
7
+ * Add support for Ruby 2.2 (https://github.com/itsmechlark)
8
+ * Add PH holidays (https://github.com/itsmechlark)
9
+ * Belgian holidays now written in French instead of English (https://github.com/maximerety)
10
+ * Update California (USA) holidays to include Cesar Chavez and Thanksgiving (https://github.com/evansagge)
11
+
3
12
  ## 1.2.0
4
13
 
5
14
  * Remove inauguration day from USA Federal Reserve definitions (https://github.com/aripollak)
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ruby Holidays Gem [![Build Status](https://travis-ci.org/alexdunae/holidays.svg?branch=master)](https://travis-ci.org/alexdunae/holidays)
1
+ # Ruby Holidays Gem [![Build Status](https://travis-ci.org/alexdunae/holidays.svg?branch=master)](https://travis-ci.org/alexdunae/holidays) [![Coverage Status](https://coveralls.io/repos/alexdunae/holidays/badge.svg)](https://coveralls.io/r/alexdunae/holidays)
2
2
 
3
3
  A set of functions to deal with holidays in Ruby.
4
4
 
data/data/be.yaml CHANGED
@@ -6,60 +6,60 @@
6
6
  ---
7
7
  months:
8
8
  0:
9
- - name: Easter
9
+ - name: Pâques
10
10
  regions: [be]
11
11
  function: easter(year)
12
- - name: Easter Monday
12
+ - name: Lundi de Pâques
13
13
  regions: [be]
14
14
  function: easter(year)+1
15
15
  - name: Ascension
16
16
  regions: [be]
17
17
  function: easter(year)+39
18
- - name: Pentecost
18
+ - name: Pentecôte
19
19
  regions: [be]
20
20
  function: easter(year)+49
21
- - name: Pentecost Monday
21
+ - name: Lundi de Pentecôte
22
22
  regions: [be]
23
23
  function: easter(year)+50
24
24
  1:
25
- - name: New Year's Day
25
+ - name: Jour de l'an
26
26
  regions: [be]
27
27
  mday: 1
28
28
  5:
29
- - name: Labour Day
29
+ - name: Fête du travail
30
30
  regions: [be]
31
31
  mday: 1
32
32
  7:
33
- - name: National holiday
33
+ - name: Fête nationale
34
34
  regions: [be]
35
35
  mday: 21
36
36
  8:
37
- - name: Assumption of Mary
37
+ - name: Assomption
38
38
  regions: [be]
39
39
  mday: 15
40
40
  11:
41
- - name: All Saints
41
+ - name: Toussaint
42
42
  regions: [be]
43
43
  mday: 1
44
- - name: Armistice Day
44
+ - name: Armistice 1918
45
45
  regions: [be]
46
46
  mday: 11
47
47
  12:
48
- - name: Christmas
48
+ - name: Noël
49
49
  regions: [be]
50
50
  mday: 25
51
51
  tests: |
52
- {Date.civil(2007,1,1) => 'New Year\'s Day',
53
- Date.civil(2007,4,8) => 'Easter',
54
- Date.civil(2007,4,9) => 'Easter Monday',
55
- Date.civil(2007,5,1) => 'Labour Day',
52
+ {Date.civil(2007,1,1) => 'Jour de l\'an',
53
+ Date.civil(2007,4,8) => 'Pâques',
54
+ Date.civil(2007,4,9) => 'Lundi de Pâques',
55
+ Date.civil(2007,5,1) => 'Fête du travail',
56
56
  Date.civil(2007,5,17) => 'Ascension',
57
- Date.civil(2007,5,27) => 'Pentecost',
58
- Date.civil(2007,5,28) => 'Pentecost Monday',
59
- Date.civil(2007,7,21) => 'National holiday',
60
- Date.civil(2007,8,15) => 'Assumption of Mary',
61
- Date.civil(2007,11,1) => 'All Saints',
62
- Date.civil(2007,11,11) => 'Armistice Day',
63
- Date.civil(2007,12,25) => 'Christmas'}.each do |date, name|
57
+ Date.civil(2007,5,27) => 'Pentecôte',
58
+ Date.civil(2007,5,28) => 'Lundi de Pentecôte',
59
+ Date.civil(2007,7,21) => 'Fête nationale',
60
+ Date.civil(2007,8,15) => 'Assomption',
61
+ Date.civil(2007,11,1) => 'Toussaint',
62
+ Date.civil(2007,11,11) => 'Armistice 1918',
63
+ Date.civil(2007,12,25) => 'Noël'}.each do |date, name|
64
64
  assert_equal name, (Holidays.on(date, :be, :informal)[0] || {})[:name]
65
65
  end
data/data/index.yaml CHANGED
@@ -35,6 +35,7 @@ defs:
35
35
  "NO": ['no.yaml']
36
36
  NYSE: ['nyse.yaml']
37
37
  NZ: ['nz.yaml']
38
+ PH: ['ph.yaml']
38
39
  PL: ['pl.yaml']
39
40
  PT: ['pt.yaml']
40
41
  RO: ['ro.yaml']
data/data/ph.yaml ADDED
@@ -0,0 +1,87 @@
1
+ # Philippines holiday definitions for the Ruby Holiday gem.
2
+ #
3
+ # Updated: 2015-03-25 by itsmechlark
4
+ # Sources:
5
+ # - http://www.gov.ph/2014/07/23/list-of-nationwide-holidays-for-2015/
6
+ # - http://www.timeanddate.com/holidays/philippines/
7
+ ---
8
+ months:
9
+ 0:
10
+ - name: Maundy Thursday
11
+ regions: [ph]
12
+ function: easter(year)-3
13
+ - name: Good Friday
14
+ regions: [ph]
15
+ function: easter(year)-2
16
+ - name: Holy Saturday
17
+ regions: [ph]
18
+ function: easter(year)-1
19
+ - name: Easter Sunday
20
+ regions: [ph]
21
+ function: easter(year)
22
+ 1:
23
+ - name: New Year’s Day
24
+ regions: [ph]
25
+ mday: 1
26
+ 2:
27
+ - name: People Power Anniversary
28
+ regions: [ph]
29
+ mday: 25
30
+ 4:
31
+ - name: The Day of Valor
32
+ regions: [ph]
33
+ mday: 9
34
+ 5:
35
+ - name: Labor Day
36
+ regions: [ph]
37
+ mday: 1
38
+ 6:
39
+ - name: Independence Day
40
+ regions: [ph]
41
+ mday: 12
42
+ 8:
43
+ - name: Ninoy Aquino Day
44
+ regions: [ph]
45
+ mday: 21
46
+ - name: National Heroes Day
47
+ regions: [ph]
48
+ function: ph_heroes_day(year)
49
+ 11:
50
+ - name: All Saints Day
51
+ regions: [ph]
52
+ mday: 1
53
+ - name: Bonifacio Day
54
+ regions: [ph]
55
+ mday: 30
56
+ 12:
57
+ - name: Christmas Day
58
+ regions: [ph]
59
+ mday: 25
60
+ - name: Rizal Day
61
+ regions: [ph]
62
+ mday: 30
63
+ - name: New Year's Eve
64
+ regions: [ph]
65
+ mday: 31
66
+ methods:
67
+ ph_heroes_day: |
68
+ # last Monday of August
69
+ def self.ph_heroes_day(year)
70
+ date = Date.new(year, 8, -1)
71
+ return date if date.wday == 1
72
+ date -= date.wday - 1
73
+ end
74
+ tests: |
75
+ {Date.civil(2015,2,25) => 'People Power Anniversary',
76
+ Date.civil(2015,4,3) => 'Good Friday',
77
+ Date.civil(2015,4,9) => 'The Day of Valor',
78
+ Date.civil(2015,5,1) => 'Labor Day',
79
+ Date.civil(2015,6,12) => 'Independence Day',
80
+ Date.civil(2015,8,21) => 'Ninoy Aquino Day',
81
+ Date.civil(2015,8,31) => 'National Heroes Day',
82
+ Date.civil(2015,11,1) => 'All Saints Day',
83
+ Date.civil(2015,11,30) => 'Bonifacio Day',
84
+ Date.civil(2015,12,25) => 'Christmas Day',
85
+ Date.civil(2015,12,30) => 'Rizal Day'}.each do |date, name|
86
+ assert_equal name, (Holidays.on(date, :ph)[0] || {})[:name]
87
+ end
data/data/us.yaml CHANGED
@@ -30,6 +30,10 @@ months:
30
30
  week: 3
31
31
  regions: [us]
32
32
  wday: 1
33
+ 3:
34
+ - name: 'Cesar Chavez Day'
35
+ regions: [us_ca]
36
+ mday: 31
33
37
  5:
34
38
  - name: Memorial Day
35
39
  week: -1
@@ -59,6 +63,10 @@ months:
59
63
  week: 4
60
64
  regions: [us]
61
65
  wday: 4
66
+ - name: Day after Thanksgiving
67
+ week: 4
68
+ regions: [us_ca]
69
+ wday: 5
62
70
  12:
63
71
  - name: Christmas Day
64
72
  regions: [us]
@@ -83,3 +91,7 @@ tests: |
83
91
  Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
84
92
  assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
85
93
  end
94
+ {Date.civil(2008, 3, 31) => 'Cesar Chavez Day',
95
+ Date.civil(2008, 11, 28) => 'Day after Thanksgiving'}.each do |date, name|
96
+ assert_equal name, (Holidays.on(date, :us, :us_ca)[0] || {})[:name]
97
+ end
data/holidays.gemspec CHANGED
@@ -18,4 +18,6 @@ Gem::Specification.new do |gem|
18
18
  gem.licenses = ['MIT']
19
19
  gem.add_development_dependency 'bundler'
20
20
  gem.add_development_dependency 'rake'
21
+ gem.add_development_dependency 'coveralls'
22
+ gem.add_development_dependency 'test-unit'
21
23
  end
@@ -38,6 +38,7 @@ The following definition files are included in this installation:
38
38
  * holidays/north_america
39
39
  * holidays/nyse
40
40
  * holidays/nz
41
+ * holidays/ph
41
42
  * holidays/pl
42
43
  * holidays/pt
43
44
  * holidays/ro
data/lib/holidays/be.rb CHANGED
@@ -18,18 +18,18 @@ module Holidays
18
18
 
19
19
  def self.holidays_by_month
20
20
  {
21
- 0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter", :regions => [:be]},
22
- {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:be]},
21
+ 0 => [{:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:be]},
22
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:be]},
23
23
  {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:be]},
24
- {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecost", :regions => [:be]},
25
- {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pentecost Monday", :regions => [:be]}],
26
- 1 => [{:mday => 1, :name => "New Year's Day", :regions => [:be]}],
27
- 5 => [{:mday => 1, :name => "Labour Day", :regions => [:be]}],
28
- 7 => [{:mday => 21, :name => "National holiday", :regions => [:be]}],
29
- 8 => [{:mday => 15, :name => "Assumption of Mary", :regions => [:be]}],
30
- 11 => [{:mday => 1, :name => "All Saints", :regions => [:be]},
31
- {:mday => 11, :name => "Armistice Day", :regions => [:be]}],
32
- 12 => [{:mday => 25, :name => "Christmas", :regions => [:be]}]
24
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:be]},
25
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:be]}],
26
+ 1 => [{:mday => 1, :name => "Jour de l'an", :regions => [:be]}],
27
+ 5 => [{:mday => 1, :name => "Fête du travail", :regions => [:be]}],
28
+ 7 => [{:mday => 21, :name => "Fête nationale", :regions => [:be]}],
29
+ 8 => [{:mday => 15, :name => "Assomption", :regions => [:be]}],
30
+ 11 => [{:mday => 1, :name => "Toussaint", :regions => [:be]},
31
+ {:mday => 11, :name => "Armistice 1918", :regions => [:be]}],
32
+ 12 => [{:mday => 25, :name => "Noël", :regions => [:be]}]
33
33
  }
34
34
  end
35
35
  end
@@ -22,11 +22,11 @@ module Holidays
22
22
  {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Christi Himmelfahrt", :regions => [:at]},
23
23
  {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pfingstmontag", :regions => [:at]},
24
24
  {:function => lambda { |year| Holidays.easter(year)+60 }, :function_id => "easter(year)+60", :name => "Fronleichnam", :regions => [:at]},
25
- {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter", :regions => [:be]},
26
- {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Easter Monday", :regions => [:be]},
25
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Pâques", :regions => [:be]},
26
+ {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Lundi de Pâques", :regions => [:be]},
27
27
  {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Ascension", :regions => [:be]},
28
- {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecost", :regions => [:be]},
29
- {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Pentecost Monday", :regions => [:be]},
28
+ {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "Pentecôte", :regions => [:be]},
29
+ {:function => lambda { |year| Holidays.easter(year)+50 }, :function_id => "easter(year)+50", :name => "Lundi de Pentecôte", :regions => [:be]},
30
30
  {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Karfreitag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_ne, :ch_ge, :ch_ju]},
31
31
  {:function => lambda { |year| Holidays.easter(year)+1 }, :function_id => "easter(year)+1", :name => "Ostermontag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vd, :ch_vs, :ch_ge, :ch_ju]},
32
32
  {:function => lambda { |year| Holidays.easter(year)+39 }, :function_id => "easter(year)+39", :name => "Auffahrt", :regions => [:ch]},
@@ -135,7 +135,7 @@ module Holidays
135
135
  {:function => lambda { |year| Holidays.easter(year)+49 }, :function_id => "easter(year)+49", :name => "binkošti", :regions => [:si]}],
136
136
  1 => [{:mday => 1, :name => "Neujahrstag", :regions => [:at]},
137
137
  {:mday => 6, :name => "Heilige Drei Könige", :regions => [:at]},
138
- {:mday => 1, :name => "New Year's Day", :regions => [:be]},
138
+ {:mday => 1, :name => "Jour de l'an", :regions => [:be]},
139
139
  {:mday => 1, :name => "Neujahrstag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_vd, :ch_vs, :ch_ne, :ch_ge, :ch_ju, :ch_ti]},
140
140
  {:mday => 2, :name => "Berchtoldstag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_sh, :ch_sg, :ch_ag, :ch_tg, :ch_vd, :ch_vs, :ch_ne, :ch_ju]},
141
141
  {:mday => 6, :name => "Dreikönigstag", :regions => [:ch_ur, :ch_sz, :ch_ti]},
@@ -175,7 +175,7 @@ module Holidays
175
175
  {:mday => 1, :name => "Nový rok", :regions => [:sk]},
176
176
  {:mday => 1, :name => "novo leto", :regions => [:si]}],
177
177
  5 => [{:mday => 1, :name => "Staatsfeiertag", :regions => [:at]},
178
- {:mday => 1, :name => "Labour Day", :regions => [:be]},
178
+ {:mday => 1, :name => "Fête du travail", :regions => [:be]},
179
179
  {:mday => 1, :name => "Tag der Arbeit", :regions => [:ch_zh, :ch_bs, :ch_bl, :ch_sh, :ch_ag, :ch_tg, :ch_ti, :ch_ne, :ch_ju]},
180
180
  {:mday => 1, :name => "Svátek práce", :regions => [:cz]},
181
181
  {:mday => 8, :name => "Den vítězství", :regions => [:cz]},
@@ -214,7 +214,7 @@ module Holidays
214
214
  {:mday => 1, :name => "praznik dela", :regions => [:si]},
215
215
  {:mday => 2, :name => "praznik dela", :regions => [:si]}],
216
216
  8 => [{:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:at]},
217
- {:mday => 15, :name => "Assumption of Mary", :regions => [:be]},
217
+ {:mday => 15, :name => "Assomption", :regions => [:be]},
218
218
  {:mday => 1, :name => "Bundesfeiertag", :regions => [:ch]},
219
219
  {:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_zg, :ch_fr, :ch_so, :ch_ai, :ch_ag, :ch_ti, :ch_vs, :ch_ju]},
220
220
  {:mday => 15, :name => "Mariä Himmelfahrt", :regions => [:de_by, :de_sl]},
@@ -250,8 +250,8 @@ module Holidays
250
250
  {:mday => 14, :type => :informal, :name => "Dzień Nauczyciela (Dzień Edukacji Narodowej)", :regions => [:pl]},
251
251
  {:mday => 31, :name => "dan reformacije", :regions => [:si]}],
252
252
  11 => [{:mday => 1, :name => "Allerheiligen", :regions => [:at]},
253
- {:mday => 1, :name => "All Saints", :regions => [:be]},
254
- {:mday => 11, :name => "Armistice Day", :regions => [:be]},
253
+ {:mday => 1, :name => "Toussaint", :regions => [:be]},
254
+ {:mday => 11, :name => "Armistice 1918", :regions => [:be]},
255
255
  {:mday => 1, :name => "Allerheiligen", :regions => [:ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_ai, :ch_sg, :ch_ag, :ch_ti, :ch_vs, :ch_ju]},
256
256
  {:mday => 17, :name => "Den boje za svobodu a demokracii", :regions => [:cz]},
257
257
  {:mday => 10, :type => :informal, :name => "Mortensaften", :regions => [:dk]},
@@ -279,7 +279,7 @@ module Holidays
279
279
  12 => [{:mday => 8, :name => "Mariä Empfägnis", :regions => [:at]},
280
280
  {:mday => 25, :name => "1. Weihnachtstag", :regions => [:at]},
281
281
  {:mday => 26, :name => "2. Weihnachtstag", :regions => [:at]},
282
- {:mday => 25, :name => "Christmas", :regions => [:be]},
282
+ {:mday => 25, :name => "Noël", :regions => [:be]},
283
283
  {:mday => 8, :name => "Maria Empfängnis", :regions => [:ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_zg, :ch_fr, :ch_ai, :ch_ag, :ch_ti, :ch_vs]},
284
284
  {:mday => 25, :name => "Weihnachten", :regions => [:ch]},
285
285
  {:mday => 26, :name => "Stefanstag", :regions => [:ch_zh, :ch_be, :ch_lu, :ch_ur, :ch_sz, :ch_ow, :ch_nw, :ch_gl, :ch_zg, :ch_fr, :ch_so, :ch_bs, :ch_bl, :ch_sh, :ch_ar, :ch_ai, :ch_sg, :ch_gr, :ch_ag, :ch_tg, :ch_ti, :ch_vs, :ch_ne]},
@@ -346,7 +346,7 @@ module Holidays
346
346
  {:mday => 26, :name => "2. sviatek vianočný", :regions => [:sk]},
347
347
  {:mday => 25, :name => "božič", :regions => [:si]},
348
348
  {:mday => 26, :name => "dan samostojnosti in enotnosti", :regions => [:si]}],
349
- 7 => [{:mday => 21, :name => "National holiday", :regions => [:be]},
349
+ 7 => [{:mday => 21, :name => "Fête nationale", :regions => [:be]},
350
350
  {:mday => 5, :name => "Den slovanských věrozvěstů Cyrila a Metoděje", :regions => [:cz]},
351
351
  {:mday => 6, :name => "Den upálení mistra Jana Husa", :regions => [:cz]},
352
352
  {:mday => 23, :observed => lambda { |date| Holidays.to_monday_if_sunday(date) }, :observed_id => "to_monday_if_sunday", :name => "Santiago Apostol", :regions => [:es_ga]},
@@ -13,7 +13,7 @@ module Holidays
13
13
  # All the definitions are available at https://github.com/alexdunae/holidays
14
14
  module NORTH_AMERICA # :nodoc:
15
15
  def self.defined_regions
16
- [: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]
16
+ [: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]
17
17
  end
18
18
 
19
19
  def self.holidays_by_month
@@ -41,6 +41,7 @@ module Holidays
41
41
  {:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
42
42
  3 => [{:mday => 23, :name => "St. George's Day", :regions => [:ca_nf]},
43
43
  {:wday => 1, :week => 3, :name => "Natalicio de Benito Juárez", :regions => [:mx]},
44
+ {:mday => 31, :name => "Cesar Chavez Day", :regions => [:us_ca]},
44
45
  {:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
45
46
  5 => [{:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "Victoria Day", :regions => [:ca]},
46
47
  {:function => lambda { |year| Holidays.ca_victoria_day(year) }, :function_id => "ca_victoria_day(year)", :name => "National Patriotes Day", :regions => [:ca_qc]},
@@ -81,7 +82,8 @@ module Holidays
81
82
  {:mday => 2, :type => :informal, :name => "Los Fieles Difuntos", :regions => [:mx]},
82
83
  {:wday => 1, :week => 3, :name => "Día de la Revolución", :regions => [:mx]},
83
84
  {:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
84
- {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
85
+ {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]},
86
+ {:wday => 5, :week => 4, :name => "Day after Thanksgiving", :regions => [:us_ca]}],
85
87
  12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ca]},
86
88
  {:mday => 26, :name => "Boxing Day", :regions => [:ca]},
87
89
  {:mday => 12, :type => :informal, :name => "Día de la Virgen de Guadalupe", :regions => [:mx]},
@@ -0,0 +1,52 @@
1
+ # encoding: utf-8
2
+ module Holidays
3
+ # This file is generated by the Ruby Holidays gem.
4
+ #
5
+ # Definitions loaded: data/ph.yaml
6
+ #
7
+ # To use the definitions in this file, load it right after you load the
8
+ # Holiday gem:
9
+ #
10
+ # require 'holidays'
11
+ # require 'holidays/ph'
12
+ #
13
+ # All the definitions are available at https://github.com/alexdunae/holidays
14
+ module PH # :nodoc:
15
+ def self.defined_regions
16
+ [:ph]
17
+ end
18
+
19
+ def self.holidays_by_month
20
+ {
21
+ 0 => [{:function => lambda { |year| Holidays.easter(year)-3 }, :function_id => "easter(year)-3", :name => "Maundy Thursday", :regions => [:ph]},
22
+ {:function => lambda { |year| Holidays.easter(year)-2 }, :function_id => "easter(year)-2", :name => "Good Friday", :regions => [:ph]},
23
+ {:function => lambda { |year| Holidays.easter(year)-1 }, :function_id => "easter(year)-1", :name => "Holy Saturday", :regions => [:ph]},
24
+ {:function => lambda { |year| Holidays.easter(year) }, :function_id => "easter(year)", :name => "Easter Sunday", :regions => [:ph]}],
25
+ 1 => [{:mday => 1, :name => "New Year’s Day", :regions => [:ph]}],
26
+ 2 => [{:mday => 25, :name => "People Power Anniversary", :regions => [:ph]}],
27
+ 4 => [{:mday => 9, :name => "The Day of Valor", :regions => [:ph]}],
28
+ 5 => [{:mday => 1, :name => "Labor Day", :regions => [:ph]}],
29
+ 6 => [{:mday => 12, :name => "Independence Day", :regions => [:ph]}],
30
+ 8 => [{:mday => 21, :name => "Ninoy Aquino Day", :regions => [:ph]},
31
+ {:function => lambda { |year| Holidays.ph_heroes_day(year) }, :function_id => "ph_heroes_day(year)", :name => "National Heroes Day", :regions => [:ph]}],
32
+ 11 => [{:mday => 1, :name => "All Saints Day", :regions => [:ph]},
33
+ {:mday => 30, :name => "Bonifacio Day", :regions => [:ph]}],
34
+ 12 => [{:mday => 25, :name => "Christmas Day", :regions => [:ph]},
35
+ {:mday => 30, :name => "Rizal Day", :regions => [:ph]},
36
+ {:mday => 31, :name => "New Year's Eve", :regions => [:ph]}]
37
+ }
38
+ end
39
+ end
40
+
41
+ # last Monday of August
42
+ def self.ph_heroes_day(year)
43
+ date = Date.new(year, 8, -1)
44
+ return date if date.wday == 1
45
+ date -= date.wday - 1
46
+ end
47
+
48
+
49
+
50
+ end
51
+
52
+ Holidays.merge_defs(Holidays::PH.defined_regions, Holidays::PH.holidays_by_month)
data/lib/holidays/us.rb CHANGED
@@ -13,7 +13,7 @@ module Holidays
13
13
  # All the definitions are available at https://github.com/alexdunae/holidays
14
14
  module US # :nodoc:
15
15
  def self.defined_regions
16
- [:us, :us_dc, :ca]
16
+ [:us, :us_dc, :us_ca, :ca]
17
17
  end
18
18
 
19
19
  def self.holidays_by_month
@@ -26,6 +26,8 @@ module Holidays
26
26
  2 => [{:wday => 1, :week => 3, :name => "Presidents' Day", :regions => [:us]},
27
27
  {:mday => 2, :type => :informal, :name => "Groundhog Day", :regions => [:us, :ca]},
28
28
  {:mday => 14, :type => :informal, :name => "Valentine's Day", :regions => [:us, :ca]}],
29
+ 3 => [{:mday => 31, :name => "Cesar Chavez Day", :regions => [:us_ca]},
30
+ {:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
29
31
  5 => [{:wday => 1, :week => -1, :name => "Memorial Day", :regions => [:us]},
30
32
  {:wday => 0, :week => 2, :type => :informal, :name => "Mother's Day", :regions => [:us, :ca]},
31
33
  {:wday => 6, :week => 3, :type => :informal, :name => "Armed Forces Day", :regions => [:us]}],
@@ -34,9 +36,9 @@ module Holidays
34
36
  10 => [{:wday => 1, :week => 2, :name => "Columbus Day", :regions => [:us]},
35
37
  {:mday => 31, :type => :informal, :name => "Halloween", :regions => [:us, :ca]}],
36
38
  11 => [{:mday => 11, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Veterans Day", :regions => [:us]},
37
- {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]}],
39
+ {:wday => 4, :week => 4, :name => "Thanksgiving", :regions => [:us]},
40
+ {:wday => 5, :week => 4, :name => "Day after Thanksgiving", :regions => [:us_ca]}],
38
41
  12 => [{:mday => 25, :observed => lambda { |date| Holidays.to_weekday_if_weekend(date) }, :observed_id => "to_weekday_if_weekend", :name => "Christmas Day", :regions => [:us]}],
39
- 3 => [{:mday => 17, :type => :informal, :name => "St. Patrick's Day", :regions => [:us, :ca]}],
40
42
  4 => [{:mday => 1, :type => :informal, :name => "April Fool's Day", :regions => [:us, :ca]},
41
43
  {:mday => 22, :type => :informal, :name => "Earth Day", :regions => [:us, :ca]}],
42
44
  6 => [{:wday => 0, :week => 3, :type => :informal, :name => "Father's Day", :regions => [:us, :ca]}]
@@ -1,3 +1,3 @@
1
1
  module Holidays
2
- VERSION = '1.2.0'
2
+ VERSION = '2.0.0'
3
3
  end
@@ -7,18 +7,18 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
7
7
  class BeDefinitionTests < Test::Unit::TestCase # :nodoc:
8
8
 
9
9
  def test_be
10
- {Date.civil(2007,1,1) => 'New Year\'s Day',
11
- Date.civil(2007,4,8) => 'Easter',
12
- Date.civil(2007,4,9) => 'Easter Monday',
13
- Date.civil(2007,5,1) => 'Labour Day',
10
+ {Date.civil(2007,1,1) => 'Jour de l\'an',
11
+ Date.civil(2007,4,8) => 'Pâques',
12
+ Date.civil(2007,4,9) => 'Lundi de Pâques',
13
+ Date.civil(2007,5,1) => 'Fête du travail',
14
14
  Date.civil(2007,5,17) => 'Ascension',
15
- Date.civil(2007,5,27) => 'Pentecost',
16
- Date.civil(2007,5,28) => 'Pentecost Monday',
17
- Date.civil(2007,7,21) => 'National holiday',
18
- Date.civil(2007,8,15) => 'Assumption of Mary',
19
- Date.civil(2007,11,1) => 'All Saints',
20
- Date.civil(2007,11,11) => 'Armistice Day',
21
- Date.civil(2007,12,25) => 'Christmas'}.each do |date, name|
15
+ Date.civil(2007,5,27) => 'Pentecôte',
16
+ Date.civil(2007,5,28) => 'Lundi de Pentecôte',
17
+ Date.civil(2007,7,21) => 'Fête nationale',
18
+ Date.civil(2007,8,15) => 'Assomption',
19
+ Date.civil(2007,11,1) => 'Toussaint',
20
+ Date.civil(2007,11,11) => 'Armistice 1918',
21
+ Date.civil(2007,12,25) => 'Noël'}.each do |date, name|
22
22
  assert_equal name, (Holidays.on(date, :be, :informal)[0] || {})[:name]
23
23
  end
24
24
  end
@@ -21,18 +21,18 @@ end
21
21
  assert !Date.civil(2010,5,8).holiday?(:at), '2010-05-08 is not a holiday in Austria'
22
22
 
23
23
 
24
- {Date.civil(2007,1,1) => 'New Year\'s Day',
25
- Date.civil(2007,4,8) => 'Easter',
26
- Date.civil(2007,4,9) => 'Easter Monday',
27
- Date.civil(2007,5,1) => 'Labour Day',
24
+ {Date.civil(2007,1,1) => 'Jour de l\'an',
25
+ Date.civil(2007,4,8) => 'Pâques',
26
+ Date.civil(2007,4,9) => 'Lundi de Pâques',
27
+ Date.civil(2007,5,1) => 'Fête du travail',
28
28
  Date.civil(2007,5,17) => 'Ascension',
29
- Date.civil(2007,5,27) => 'Pentecost',
30
- Date.civil(2007,5,28) => 'Pentecost Monday',
31
- Date.civil(2007,7,21) => 'National holiday',
32
- Date.civil(2007,8,15) => 'Assumption of Mary',
33
- Date.civil(2007,11,1) => 'All Saints',
34
- Date.civil(2007,11,11) => 'Armistice Day',
35
- Date.civil(2007,12,25) => 'Christmas'}.each do |date, name|
29
+ Date.civil(2007,5,27) => 'Pentecôte',
30
+ Date.civil(2007,5,28) => 'Lundi de Pentecôte',
31
+ Date.civil(2007,7,21) => 'Fête nationale',
32
+ Date.civil(2007,8,15) => 'Assomption',
33
+ Date.civil(2007,11,1) => 'Toussaint',
34
+ Date.civil(2007,11,11) => 'Armistice 1918',
35
+ Date.civil(2007,12,25) => 'Noël'}.each do |date, name|
36
36
  assert_equal name, (Holidays.on(date, :be, :informal)[0] || {})[:name]
37
37
  end
38
38
 
@@ -82,6 +82,10 @@ end
82
82
  Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
83
83
  assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
84
84
  end
85
+ {Date.civil(2008, 3, 31) => 'Cesar Chavez Day',
86
+ Date.civil(2008, 11, 28) => 'Day after Thanksgiving'}.each do |date, name|
87
+ assert_equal name, (Holidays.on(date, :us, :us_ca)[0] || {})[:name]
88
+ end
85
89
 
86
90
 
87
91
  {Date.civil(2013,2,2) => 'Groundhog Day',
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
3
+
4
+ # This file is generated by the Ruby Holiday gem.
5
+ #
6
+ # Definitions loaded: data/ph.yaml
7
+ class PhDefinitionTests < Test::Unit::TestCase # :nodoc:
8
+
9
+ def test_ph
10
+ {Date.civil(2015,2,25) => 'People Power Anniversary',
11
+ Date.civil(2015,4,3) => 'Good Friday',
12
+ Date.civil(2015,4,9) => 'The Day of Valor',
13
+ Date.civil(2015,5,1) => 'Labor Day',
14
+ Date.civil(2015,6,12) => 'Independence Day',
15
+ Date.civil(2015,8,21) => 'Ninoy Aquino Day',
16
+ Date.civil(2015,8,31) => 'National Heroes Day',
17
+ Date.civil(2015,11,1) => 'All Saints Day',
18
+ Date.civil(2015,11,30) => 'Bonifacio Day',
19
+ Date.civil(2015,12,25) => 'Christmas Day',
20
+ Date.civil(2015,12,30) => 'Rizal Day'}.each do |date, name|
21
+ assert_equal name, (Holidays.on(date, :ph)[0] || {})[:name]
22
+ end
23
+
24
+ end
25
+ end
@@ -19,6 +19,10 @@ class UsDefinitionTests < Test::Unit::TestCase # :nodoc:
19
19
  Date.civil(2008,12,25) => 'Christmas Day'}.each do |date, name|
20
20
  assert_equal name, (Holidays.on(date, :us)[0] || {})[:name]
21
21
  end
22
+ {Date.civil(2008, 3, 31) => 'Cesar Chavez Day',
23
+ Date.civil(2008, 11, 28) => 'Day after Thanksgiving'}.each do |date, name|
24
+ assert_equal name, (Holidays.on(date, :us, :us_ca)[0] || {})[:name]
25
+ end
22
26
 
23
27
 
24
28
  {Date.civil(2013,2,2) => 'Groundhog Day',
data/test/test_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  $:.unshift(File.expand_path(File.dirname(__FILE__) + '../../lib/'))
2
5
 
3
6
  $KCODE = 'u' if RUBY_VERSION =~ /^1\.8/
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: holidays
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dunae
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,34 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: coveralls
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
41
69
  description: A collection of Ruby methods to deal with statutory and other holidays.
42
70
  You deserve a holiday!
43
71
  email:
@@ -91,6 +119,7 @@ files:
91
119
  - data/north_america_informal.yaml
92
120
  - data/nyse.yaml
93
121
  - data/nz.yaml
122
+ - data/ph.yaml
94
123
  - data/pl.yaml
95
124
  - data/pt.yaml
96
125
  - data/ro.yaml
@@ -144,6 +173,7 @@ files:
144
173
  - lib/holidays/north_america.rb
145
174
  - lib/holidays/nyse.rb
146
175
  - lib/holidays/nz.rb
176
+ - lib/holidays/ph.rb
147
177
  - lib/holidays/pl.rb
148
178
  - lib/holidays/pt.rb
149
179
  - lib/holidays/ro.rb
@@ -199,6 +229,7 @@ files:
199
229
  - test/defs/test_defs_north_america.rb
200
230
  - test/defs/test_defs_nyse.rb
201
231
  - test/defs/test_defs_nz.rb
232
+ - test/defs/test_defs_ph.rb
202
233
  - test/defs/test_defs_pl.rb
203
234
  - test/defs/test_defs_pt.rb
204
235
  - test/defs/test_defs_ro.rb
@@ -285,6 +316,7 @@ test_files:
285
316
  - test/defs/test_defs_north_america.rb
286
317
  - test/defs/test_defs_nyse.rb
287
318
  - test/defs/test_defs_nz.rb
319
+ - test/defs/test_defs_ph.rb
288
320
  - test/defs/test_defs_pl.rb
289
321
  - test/defs/test_defs_pt.rb
290
322
  - test/defs/test_defs_ro.rb