holidays 4.1.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/definitions/nl.yaml +14 -14
- data/lib/generated_definitions/europe.rb +7 -7
- data/lib/generated_definitions/nl.rb +7 -7
- data/lib/holidays.rb +5 -1
- data/lib/holidays/use_case/context/dates_driver_builder.rb +2 -0
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_europe.rb +7 -7
- data/test/defs/test_defs_nl.rb +7 -7
- data/test/test_holidays.rb +8 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74b677a9819268733c692afe11958c2cf1ccaed
|
4
|
+
data.tar.gz: faedba7eb3f149f92de77ddb7ec567cc708a2485
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7530fa6ee86e2c3fe1136eac771c0d307d89cdb4e870c7fc2f4de8d14af8a967055c1c75ee6299a3e0f6238f3c50ea832c6db715c854a1a09814e32bdd397276
|
7
|
+
data.tar.gz: 9a608809435239e4ae5a7b7d6f97e3ae085afdd40eac49808b9947287f404442af265bd529508b3c1dfeae3b5f90c209fe967d78615de28906a327dd4222ee26
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Ruby Holidays Gem CHANGELOG
|
2
2
|
|
3
|
+
## 4.2.0
|
4
|
+
|
5
|
+
* BUGFIX Issue-194: correctly calculate `next_holidays` if next holiday is far in the future
|
6
|
+
* Give dutch holidays their proper names (https://github.com/Qqwy)
|
7
|
+
|
3
8
|
## 4.1.0
|
4
9
|
|
5
10
|
* Issue-161: correctly report St Andrews Day as informal 2006 and earlier in `gb_sct`
|
data/definitions/nl.yaml
CHANGED
@@ -11,10 +11,10 @@ months:
|
|
11
11
|
function: easter(year)
|
12
12
|
function_modifier: -2
|
13
13
|
type: informal
|
14
|
-
- name: Eerste
|
14
|
+
- name: Eerste Paasdag
|
15
15
|
regions: [nl]
|
16
16
|
function: easter(year)
|
17
|
-
- name: Tweede
|
17
|
+
- name: Tweede Paasdag
|
18
18
|
regions: [nl]
|
19
19
|
function: easter(year)
|
20
20
|
function_modifier: 1
|
@@ -22,16 +22,16 @@ months:
|
|
22
22
|
regions: [nl]
|
23
23
|
function: easter(year)
|
24
24
|
function_modifier: 39
|
25
|
-
- name: Eerste
|
25
|
+
- name: Eerste Pinksterdag
|
26
26
|
regions: [nl]
|
27
27
|
function: easter(year)
|
28
28
|
function_modifier: 49
|
29
|
-
- name: Tweede
|
29
|
+
- name: Tweede Pinksterdag
|
30
30
|
regions: [nl]
|
31
31
|
function: easter(year)
|
32
32
|
function_modifier: 50
|
33
33
|
1:
|
34
|
-
- name:
|
34
|
+
- name: Nieuwjaarsdag
|
35
35
|
regions: [nl]
|
36
36
|
mday: 1
|
37
37
|
4:
|
@@ -51,23 +51,23 @@ months:
|
|
51
51
|
regions: [nl]
|
52
52
|
mday: 5
|
53
53
|
type: informal
|
54
|
-
- name: Eerste
|
54
|
+
- name: Eerste Kerstdag
|
55
55
|
regions: [nl]
|
56
56
|
mday: 25
|
57
|
-
- name: Tweede
|
57
|
+
- name: Tweede Kerstdag
|
58
58
|
regions: [nl]
|
59
59
|
mday: 26
|
60
60
|
tests: |
|
61
|
-
{Date.civil(2008,1,1) => '
|
61
|
+
{Date.civil(2008,1,1) => 'Nieuwjaarsdag',
|
62
62
|
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
63
|
-
Date.civil(2008,3,23) => 'Eerste
|
64
|
-
Date.civil(2008,3,24) => 'Tweede
|
63
|
+
Date.civil(2008,3,23) => 'Eerste Paasdag',
|
64
|
+
Date.civil(2008,3,24) => 'Tweede Paasdag',
|
65
65
|
Date.civil(2008,4,27) => 'Koningsdag',
|
66
66
|
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
67
67
|
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
68
|
-
Date.civil(2008,5,11) => 'Eerste
|
69
|
-
Date.civil(2008,5,12) => 'Tweede
|
70
|
-
Date.civil(2008,12,25) => 'Eerste
|
71
|
-
Date.civil(2008,12,26) => 'Tweede
|
68
|
+
Date.civil(2008,5,11) => 'Eerste Pinksterdag', # Pentecost, Easter+49
|
69
|
+
Date.civil(2008,5,12) => 'Tweede Pinksterdag', # Pentecost, Easter+50
|
70
|
+
Date.civil(2008,12,25) => 'Eerste Kerstdag',
|
71
|
+
Date.civil(2008,12,26) => 'Tweede Kerstdag'}.each do |date, name|
|
72
72
|
assert_equal name, (Holidays.on(date, :nl, :informal)[0] || {})[:name]
|
73
73
|
end
|
@@ -107,11 +107,11 @@ module Holidays
|
|
107
107
|
{:function => "easter(year)", :function_arguments => [:year], :name => "Šv. Velykos", :regions => [:lt]},
|
108
108
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Antroji Velykų diena", :regions => [:lt]},
|
109
109
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Goede Vrijdag", :regions => [:nl]},
|
110
|
-
{:function => "easter(year)", :function_arguments => [:year], :name => "Eerste
|
111
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Tweede
|
110
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Eerste Paasdag", :regions => [:nl]},
|
111
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Tweede Paasdag", :regions => [:nl]},
|
112
112
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Hemelvaartsdag", :regions => [:nl]},
|
113
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Eerste
|
114
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Tweede
|
113
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Eerste Pinksterdag", :regions => [:nl]},
|
114
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Tweede Pinksterdag", :regions => [:nl]},
|
115
115
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -49, :type => :informal, :name => "Fastelavn", :regions => [:no]},
|
116
116
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -7, :name => "Palmesøndag", :regions => [:no]},
|
117
117
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -3, :name => "Skjærtorsdag", :regions => [:no]},
|
@@ -181,7 +181,7 @@ module Holidays
|
|
181
181
|
{:mday => 1, :name => "Neujahrstag", :regions => [:li]},
|
182
182
|
{:mday => 6, :name => "Heilige Drei Könige", :regions => [:li]},
|
183
183
|
{:mday => 1, :name => "Naujieji metai", :regions => [:lt]},
|
184
|
-
{:mday => 1, :name => "
|
184
|
+
{:mday => 1, :name => "Nieuwjaarsdag", :regions => [:nl]},
|
185
185
|
{:mday => 1, :name => "Nyttårsdag", :regions => [:no]},
|
186
186
|
{:mday => 1, :name => "Nowy Rok", :regions => [:pl]},
|
187
187
|
{:function => "pl_trzech_kroli(year)", :function_arguments => [:year], :name => "Objawienie Pańskie (święto Trzech Króli)", :regions => [:pl]},
|
@@ -365,8 +365,8 @@ module Holidays
|
|
365
365
|
{:mday => 25, :name => "Šv. Kalėdos", :regions => [:lt]},
|
366
366
|
{:mday => 26, :name => "Antroji Kalėdų diena", :regions => [:lt]},
|
367
367
|
{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
368
|
-
{:mday => 25, :name => "Eerste
|
369
|
-
{:mday => 26, :name => "Tweede
|
368
|
+
{:mday => 25, :name => "Eerste Kerstdag", :regions => [:nl]},
|
369
|
+
{:mday => 26, :name => "Tweede Kerstdag", :regions => [:nl]},
|
370
370
|
{:mday => 24, :type => :informal, :name => "Julaften", :regions => [:no]},
|
371
371
|
{:mday => 25, :name => "1. juledag", :regions => [:no]},
|
372
372
|
{:mday => 26, :name => "2. juledag", :regions => [:no]},
|
@@ -19,18 +19,18 @@ module Holidays
|
|
19
19
|
def self.holidays_by_month
|
20
20
|
{
|
21
21
|
0 => [{:function => "easter(year)", :function_arguments => [:year], :function_modifier => -2, :type => :informal, :name => "Goede Vrijdag", :regions => [:nl]},
|
22
|
-
{:function => "easter(year)", :function_arguments => [:year], :name => "Eerste
|
23
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Tweede
|
22
|
+
{:function => "easter(year)", :function_arguments => [:year], :name => "Eerste Paasdag", :regions => [:nl]},
|
23
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 1, :name => "Tweede Paasdag", :regions => [:nl]},
|
24
24
|
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 39, :name => "Hemelvaartsdag", :regions => [:nl]},
|
25
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Eerste
|
26
|
-
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Tweede
|
27
|
-
1 => [{:mday => 1, :name => "
|
25
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 49, :name => "Eerste Pinksterdag", :regions => [:nl]},
|
26
|
+
{:function => "easter(year)", :function_arguments => [:year], :function_modifier => 50, :name => "Tweede Pinksterdag", :regions => [:nl]}],
|
27
|
+
1 => [{:mday => 1, :name => "Nieuwjaarsdag", :regions => [:nl]}],
|
28
28
|
4 => [{:mday => 27, :name => "Koningsdag", :regions => [:nl]}],
|
29
29
|
5 => [{:mday => 4, :type => :informal, :name => "Dodenherdenking", :regions => [:nl]},
|
30
30
|
{:mday => 5, :name => "Bevrijdingsdag", :regions => [:nl]}],
|
31
31
|
12 => [{:mday => 5, :type => :informal, :name => "Sinterklaas", :regions => [:nl]},
|
32
|
-
{:mday => 25, :name => "Eerste
|
33
|
-
{:mday => 26, :name => "Tweede
|
32
|
+
{:mday => 25, :name => "Eerste Kerstdag", :regions => [:nl]},
|
33
|
+
{:mday => 26, :name => "Tweede Kerstdag", :regions => [:nl]}]
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
data/lib/holidays.rb
CHANGED
@@ -151,7 +151,11 @@ module Holidays
|
|
151
151
|
|
152
152
|
from_date = get_date(from_date)
|
153
153
|
regions, observed, informal = OptionFactory.parse_options.call(options)
|
154
|
-
|
154
|
+
|
155
|
+
# This could be smarter but I don't have any evidence that just checking for
|
156
|
+
# the next 12 months will cause us issues. If it does we can implement something
|
157
|
+
# smarter here to check in smaller increments.
|
158
|
+
date_driver_hash = UseCaseFactory.dates_driver_builder.call(from_date, from_date >> 12)
|
155
159
|
|
156
160
|
UseCaseFactory.next_holiday.call(holidays_count, from_date, date_driver_hash, regions, observed, informal)
|
157
161
|
end
|
@@ -15,6 +15,8 @@ module Holidays
|
|
15
15
|
clean(dates_driver)
|
16
16
|
end
|
17
17
|
|
18
|
+
#FIXME Why is the date_driver set to optional as the first param? That's
|
19
|
+
# just plain wrong...
|
18
20
|
def build(dates_driver = {}, date)
|
19
21
|
raise ArgumentError unless dates_driver
|
20
22
|
raise ArgumentError unless date
|
data/lib/holidays/version.rb
CHANGED
@@ -514,17 +514,17 @@ end
|
|
514
514
|
end
|
515
515
|
|
516
516
|
|
517
|
-
{Date.civil(2008,1,1) => '
|
517
|
+
{Date.civil(2008,1,1) => 'Nieuwjaarsdag',
|
518
518
|
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
519
|
-
Date.civil(2008,3,23) => 'Eerste
|
520
|
-
Date.civil(2008,3,24) => 'Tweede
|
519
|
+
Date.civil(2008,3,23) => 'Eerste Paasdag',
|
520
|
+
Date.civil(2008,3,24) => 'Tweede Paasdag',
|
521
521
|
Date.civil(2008,4,27) => 'Koningsdag',
|
522
522
|
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
523
523
|
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
524
|
-
Date.civil(2008,5,11) => 'Eerste
|
525
|
-
Date.civil(2008,5,12) => 'Tweede
|
526
|
-
Date.civil(2008,12,25) => 'Eerste
|
527
|
-
Date.civil(2008,12,26) => 'Tweede
|
524
|
+
Date.civil(2008,5,11) => 'Eerste Pinksterdag', # Pentecost, Easter+49
|
525
|
+
Date.civil(2008,5,12) => 'Tweede Pinksterdag', # Pentecost, Easter+50
|
526
|
+
Date.civil(2008,12,25) => 'Eerste Kerstdag',
|
527
|
+
Date.civil(2008,12,26) => 'Tweede Kerstdag'}.each do |date, name|
|
528
528
|
assert_equal name, (Holidays.on(date, :nl, :informal)[0] || {})[:name]
|
529
529
|
end
|
530
530
|
|
data/test/defs/test_defs_nl.rb
CHANGED
@@ -7,17 +7,17 @@ require File.expand_path(File.dirname(__FILE__)) + '/../test_helper'
|
|
7
7
|
class NlDefinitionTests < Test::Unit::TestCase # :nodoc:
|
8
8
|
|
9
9
|
def test_nl
|
10
|
-
{Date.civil(2008,1,1) => '
|
10
|
+
{Date.civil(2008,1,1) => 'Nieuwjaarsdag',
|
11
11
|
Date.civil(2008,3,21) => 'Goede Vrijdag',
|
12
|
-
Date.civil(2008,3,23) => 'Eerste
|
13
|
-
Date.civil(2008,3,24) => 'Tweede
|
12
|
+
Date.civil(2008,3,23) => 'Eerste Paasdag',
|
13
|
+
Date.civil(2008,3,24) => 'Tweede Paasdag',
|
14
14
|
Date.civil(2008,4,27) => 'Koningsdag',
|
15
15
|
Date.civil(2008,5,1) => 'Hemelvaartsdag', # Ascension, Easter+39
|
16
16
|
Date.civil(2008,5,5) => 'Bevrijdingsdag',
|
17
|
-
Date.civil(2008,5,11) => 'Eerste
|
18
|
-
Date.civil(2008,5,12) => 'Tweede
|
19
|
-
Date.civil(2008,12,25) => 'Eerste
|
20
|
-
Date.civil(2008,12,26) => 'Tweede
|
17
|
+
Date.civil(2008,5,11) => 'Eerste Pinksterdag', # Pentecost, Easter+49
|
18
|
+
Date.civil(2008,5,12) => 'Tweede Pinksterdag', # Pentecost, Easter+50
|
19
|
+
Date.civil(2008,12,25) => 'Eerste Kerstdag',
|
20
|
+
Date.civil(2008,12,26) => 'Tweede Kerstdag'}.each do |date, name|
|
21
21
|
assert_equal name, (Holidays.on(date, :nl, :informal)[0] || {})[:name]
|
22
22
|
end
|
23
23
|
|
data/test/test_holidays.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require File.expand_path(File.dirname(__FILE__)) + '/test_helper'
|
2
3
|
|
3
4
|
require "#{Holidays::DEFINITIONS_PATH}/ca"
|
@@ -6,6 +7,8 @@ require "#{Holidays::DEFINITIONS_PATH}/ca"
|
|
6
7
|
# defs aren't duplicated.
|
7
8
|
require "#{Holidays::DEFINITIONS_PATH}/north_america"
|
8
9
|
|
10
|
+
# These are effectively integration tests. We plan on making this explicit somehow
|
11
|
+
# in the future.
|
9
12
|
class HolidaysTests < Test::Unit::TestCase
|
10
13
|
def setup
|
11
14
|
@date = Date.civil(2008,1,1)
|
@@ -118,6 +121,10 @@ class HolidaysTests < Test::Unit::TestCase
|
|
118
121
|
holidays = Holidays.next_holidays(2, [:any], Date.civil(2008,5,1))
|
119
122
|
assert_equal 2, holidays.length
|
120
123
|
|
124
|
+
# Should return 1 holiday in July
|
125
|
+
holidays = Holidays.next_holidays(1, [:jp], Date.civil(2016, 5, 22))
|
126
|
+
assert_equal ['2016-07-18','海の日'] , [holidays.first[:date].to_s, holidays.first[:name].to_s]
|
127
|
+
|
121
128
|
# Must Region.If there is not region, raise ArgumentError.
|
122
129
|
assert_raises ArgumentError do
|
123
130
|
Holidays.next_holidays(2, '', Date.civil(2008,5,1))
|
@@ -149,7 +156,7 @@ class HolidaysTests < Test::Unit::TestCase
|
|
149
156
|
def test_sub_regions_holiday_next
|
150
157
|
# Should return Victoria Day.
|
151
158
|
holidays = Holidays.next_holidays(2, [:ca], Date.civil(2008,5,1))
|
152
|
-
assert_equal
|
159
|
+
assert_equal 2, holidays.length
|
153
160
|
assert_equal ['2008-05-19','Victoria Day'] , [holidays.first[:date].to_s, holidays.first[:name].to_s]
|
154
161
|
|
155
162
|
# Should return Victoria Da and National Patriotes Day.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: holidays
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dunae
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-06-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|