nzholidays 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7268ff9ac738cdad3c5175d76c1ca9c38c478a49
4
+ data.tar.gz: e8c868191e4ae94f5ce37881ff843547d5c781ea
5
+ SHA512:
6
+ metadata.gz: '0408f3674c1395018486611ae3c5234977fb46f16cb91b9502ff67d3dbc88320d82280fa7c794a886970dfc65843f9e1926c45d6b70c63a87148a1b2e8839e66'
7
+ data.tar.gz: 42a977ea259c79b482ea74fd8d6bbe5b8d9bf548447317bc21d88dbcf64cd0bc82c18ed69c7afe1adf95b48c9b6545b787e23b0eb032ba738992a0f4f6577c5a
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.2
5
+ before_install: gem install bundler -v 1.16.0
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at 105003+carld@users.noreply.github.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in nzholidays.gemspec
6
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Carl Douglas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # Nzholidays
2
+
3
+ This gem offers a way to determine whether a date is a New Zealand public
4
+ holiday.
5
+
6
+ ```
7
+ irb(main):001:0> time = Time.new(2017, 12, 25)
8
+ => 2017-12-25 00:00:00 +1300
9
+ irb(main):002:0> Nzholidays.nz_public_holiday?(time)
10
+ => true
11
+ ```
12
+
13
+ ## Installation
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'nzholidays'
19
+ ```
20
+
21
+ And then execute:
22
+
23
+ $ bundle
24
+
25
+ Or install it yourself as:
26
+
27
+ $ gem install nzholidays
28
+
29
+ ## Usage
30
+
31
+ TODO: Write usage instructions here
32
+
33
+ ## Development
34
+
35
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
36
+
37
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
+
39
+ To download the ics file and regenerate the ruby code from the template run `rake generate`.
40
+
41
+ Or just run the default task which regenerates the code and then runs rspec:
42
+
43
+ ```
44
+ bundle exec rake
45
+ ```
46
+
47
+ ## Contributing
48
+
49
+ Bug reports and pull requests are welcome on GitHub at https://github.com/carld/nzholidays. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
50
+
51
+ ## License
52
+
53
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
54
+
55
+ ## Code of Conduct
56
+
57
+ Everyone interacting in the Nzholidays project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/carld/nzholidays/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => [:generate, :spec]
7
+
8
+ task :generate do
9
+
10
+ require 'erb'
11
+
12
+ template = 'lib/nzholidays/template.erb'
13
+ output = 'lib/nzholidays.rb'
14
+
15
+ erb = ERB.new(File.read(template), nil, '-')
16
+ erb.filename = template
17
+
18
+ File.open(output, 'w') do |f|
19
+ f.write erb.result(binding)
20
+ end
21
+
22
+ end
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "nzholidays"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,82 @@
1
+ <%
2
+ require "bundler/setup"
3
+
4
+ require 'open-uri'
5
+ require 'net/http'
6
+ require 'icalendar'
7
+ require 'tzinfo'
8
+
9
+ SOURCE_URL = 'http://apps.employment.govt.nz/ical/public-holidays-all.ics'
10
+ FILE='holidays.ics'
11
+
12
+ # Download the ICS file
13
+ open(FILE, 'wb') do |file|
14
+ file << open(SOURCE_URL).read
15
+ end
16
+
17
+ cal_file = File.open(FILE)
18
+ calendars = Icalendar::Calendar.parse(cal_file)
19
+
20
+ -%>
21
+ # Auto-generated at <%= Time.now %>
22
+ # Do not edit - see template lib/nzholidays/template.erb
23
+ # To regenerate, `bundle exec rake generate`
24
+
25
+ require "nzholidays/version"
26
+ require 'time'
27
+ require 'tzinfo'
28
+
29
+ module Nzholidays
30
+
31
+ NZ_TIME_ZONE = TZInfo::Timezone.get('Pacific/Auckland')
32
+
33
+ def self.nz_time(year, month, day)
34
+
35
+ # Holiday starts at the beginning of the given day
36
+ time = ::Time.new(year, month, day, 0, 0, 0)
37
+
38
+ # Find the UTC total offset (daylight savings or standard time) for time
39
+
40
+ # note period_for_local ignores timezone info in the time object
41
+ # http://www.rubydoc.info/gems/tzinfo/TZInfo/Timezone#period_for_local-instance_method
42
+
43
+ utc_total_offset = NZ_TIME_ZONE.period_for_local(time).utc_total_offset
44
+
45
+ time.getlocal(utc_total_offset)
46
+ end
47
+
48
+ HOLIDAYS = [
49
+ <% calendars.each do |calendar|
50
+ calendar.events.each do |event|
51
+ -%>
52
+ nz_time( <%= event.dtstart.year %>, <%= event.dtstart.month %>, <%= event.dtstart.day %> ), # <%= event.summary %>
53
+ <%
54
+ end
55
+ end
56
+ -%>
57
+ ]
58
+
59
+ ANNIVERSARIES = [
60
+ <% calendars.each do |calendar|
61
+ calendar.events.select {|e| !!e.summary.match(/Anniversary/i) }.each do |event|
62
+ -%>
63
+ nz_time( <%= event.dtstart.year %>, <%= event.dtstart.month %>, <%= event.dtstart.day %> ), # <%= event.summary %>
64
+ <%
65
+ end
66
+ end
67
+ -%>
68
+ ]
69
+
70
+ def self.nz_public_holiday?(query)
71
+ !!HOLIDAYS.find do |hol|
72
+ hol.year == query.year && hol.month == query.month && hol.day == query.day
73
+ end
74
+ end
75
+
76
+ def self.nz_anniversary?(query)
77
+ !!ANNIVERSARIES.find do |hol|
78
+ hol.year == query.year && hol.month == query.month && hol.day == query.day
79
+ end
80
+ end
81
+
82
+ end
@@ -0,0 +1,3 @@
1
+ module Nzholidays
2
+ VERSION = "0.1.0"
3
+ end
data/lib/nzholidays.rb ADDED
@@ -0,0 +1,515 @@
1
+ # Auto-generated at 2017-12-18 12:12:04 +1300
2
+ # Do not edit - see template lib/nzholidays/template.erb
3
+ # To regenerate, `bundle exec rake generate`
4
+
5
+ require "nzholidays/version"
6
+ require 'time'
7
+ require 'tzinfo'
8
+
9
+ module Nzholidays
10
+
11
+ NZ_TIME_ZONE = TZInfo::Timezone.get('Pacific/Auckland')
12
+
13
+ def self.nz_time(year, month, day)
14
+
15
+ # Holiday starts at the beginning of the given day
16
+ time = ::Time.new(year, month, day, 0, 0, 0)
17
+
18
+ # Find the UTC total offset (daylight savings or standard time) for time
19
+
20
+ # note period_for_local ignores timezone info in the time object
21
+ # http://www.rubydoc.info/gems/tzinfo/TZInfo/Timezone#period_for_local-instance_method
22
+
23
+ utc_total_offset = NZ_TIME_ZONE.period_for_local(time).utc_total_offset
24
+
25
+ time.getlocal(utc_total_offset)
26
+ end
27
+
28
+ HOLIDAYS = [
29
+ nz_time( 2009, 4, 10 ), # Good Friday
30
+ nz_time( 2009, 4, 13 ), # Easter Monday
31
+ nz_time( 2009, 2, 6 ), # Waitangi Day
32
+ nz_time( 2009, 4, 25 ), # ANZAC Day
33
+ nz_time( 2009, 6, 1 ), # Queen's Birthday
34
+ nz_time( 2009, 10, 26 ), # Labour Day
35
+ nz_time( 2009, 12, 26 ), # Boxing Day (Public Holiday for employees who would normally work on Saturday)
36
+ nz_time( 2009, 12, 25 ), # Christmas Day
37
+ nz_time( 2009, 1, 2 ), # Day after New Year's Day
38
+ nz_time( 2009, 12, 28 ), # Boxing Day Public Holiday for employees who would not normally work on Saturday
39
+ nz_time( 2010, 1, 1 ), # New Year's Day
40
+ nz_time( 2010, 4, 5 ), # Easter Monday
41
+ nz_time( 2010, 6, 7 ), # Queen's Birthday
42
+ nz_time( 2008, 12, 26 ), # Boxing Day
43
+ nz_time( 2008, 12, 25 ), # Christmas Day
44
+ nz_time( 2009, 1, 1 ), # New Year's Day
45
+ nz_time( 2010, 12, 25 ), # Christmas Day (Public Holiday for employees who would normally work on Saturday)
46
+ nz_time( 2010, 12, 28 ), # Boxing Day Public Holiday for employees who would not normally work on Sunday
47
+ nz_time( 2010, 12, 26 ), # Boxing Day (Public Holiday for employees who would normally work on Sunday)
48
+ nz_time( 2011, 1, 3 ), # New Year's Day Public Holiday for employees who would not normally work on Saturday
49
+ nz_time( 2011, 4, 22 ), # Good Friday
50
+ nz_time( 2011, 1, 4 ), # Day after New Year's Day Public Holiday for employees who would not normally work on Sunday
51
+ nz_time( 2011, 10, 24 ), # Labour Day
52
+ nz_time( 2011, 4, 25 ), # Easter Monday
53
+ nz_time( 2011, 6, 6 ), # Queen's Birthday
54
+ nz_time( 2011, 12, 25 ), # Christmas Day (Public Holiday for employees who would normally work on Sunday)
55
+ nz_time( 2011, 12, 27 ), # Christmas Day (Public Holiday for employees who would not normally work on Sunday)
56
+ nz_time( 2011, 12, 26 ), # Boxing Day
57
+ nz_time( 2012, 1, 3 ), # New Year's Day Public Holiday for employees who would not normally work on Sunday
58
+ nz_time( 2010, 4, 2 ), # Good Friday
59
+ nz_time( 2010, 10, 25 ), # Labour Day
60
+ nz_time( 2010, 12, 27 ), # Christmas Day Public Holiday for employees who would not normally work on Saturday
61
+ nz_time( 2012, 4, 9 ), # Easter Monday
62
+ nz_time( 2012, 10, 22 ), # Labour Day
63
+ nz_time( 2012, 6, 4 ), # Queen's Birthday
64
+ nz_time( 2012, 12, 26 ), # Boxing Day
65
+ nz_time( 2012, 12, 25 ), # Christmas Day
66
+ nz_time( 2013, 1, 1 ), # New Year's Day
67
+ nz_time( 2013, 1, 2 ), # Day after New Year's Day
68
+ nz_time( 2013, 4, 1 ), # Easter Monday
69
+ nz_time( 2013, 3, 29 ), # Good Friday
70
+ nz_time( 2013, 10, 28 ), # Labour Day
71
+ nz_time( 2013, 6, 3 ), # Queen's Birthday
72
+ nz_time( 2013, 12, 25 ), # Christmas Day
73
+ nz_time( 2013, 12, 26 ), # Boxing Day
74
+ nz_time( 2012, 1, 1 ), # New Year's Day (Public Holiday for employees who would normally work on Sunday)
75
+ nz_time( 2012, 4, 6 ), # Good Friday
76
+ nz_time( 2012, 1, 2 ), # Day after New Year's Day
77
+ nz_time( 2014, 4, 18 ), # Good Friday
78
+ nz_time( 2014, 1, 2 ), # Day after New Year's Day
79
+ nz_time( 2014, 1, 1 ), # New Year's Day
80
+ nz_time( 2014, 4, 21 ), # Easter Monday
81
+ nz_time( 2008, 12, 1 ), # Westland Anniversary Day
82
+ nz_time( 2008, 12, 1 ), # Chatham Islands Anniversary Day
83
+ nz_time( 2009, 1, 26 ), # Auckland Anniversary Day
84
+ nz_time( 2009, 1, 19 ), # Wellington Anniversary Day
85
+ nz_time( 2009, 2, 2 ), # Nelson Anniversary Day
86
+ nz_time( 2009, 1, 19 ), # Southland Anniversary Day
87
+ nz_time( 2009, 3, 9 ), # Taranaki Anniversary Day
88
+ nz_time( 2009, 9, 28 ), # South Canterbury Anniversary Day
89
+ nz_time( 2009, 11, 13 ), # Canterbury Anniversary Day
90
+ nz_time( 2009, 11, 30 ), # Chatham Islands Anniversary Day
91
+ nz_time( 2010, 1, 25 ), # Wellington Anniversary Day
92
+ nz_time( 2009, 11, 30 ), # Westland Anniversary Day
93
+ nz_time( 2010, 2, 1 ), # Auckland Anniversary Day
94
+ nz_time( 2010, 3, 8 ), # Taranaki Anniversary Day
95
+ nz_time( 2010, 1, 18 ), # Southland Anniversary Day
96
+ nz_time( 2010, 2, 1 ), # Nelson Anniversary Day
97
+ nz_time( 2010, 9, 27 ), # South Canterbury Anniversary Day
98
+ nz_time( 2010, 3, 22 ), # Otago Anniversary Day
99
+ nz_time( 2010, 11, 1 ), # Marlborough Anniversary Day
100
+ nz_time( 2010, 10, 22 ), # Hawkes' Bay Anniversary Day
101
+ nz_time( 2009, 3, 23 ), # Otago Anniversary Day
102
+ nz_time( 2009, 11, 2 ), # Marlborough Anniversary Day
103
+ nz_time( 2009, 10, 23 ), # Hawkes' Bay Anniversary Day
104
+ nz_time( 2010, 11, 29 ), # Chatham Islands Anniversary Day
105
+ nz_time( 2011, 1, 31 ), # Nelson Anniversary Day
106
+ nz_time( 2011, 1, 17 ), # Southland Anniversary Day
107
+ nz_time( 2011, 1, 24 ), # Wellington Anniversary Day
108
+ nz_time( 2011, 3, 14 ), # Taranaki Anniversary Day
109
+ nz_time( 2011, 9, 26 ), # South Canterbury Anniversary Day
110
+ nz_time( 2011, 3, 21 ), # Otago Anniversary Day
111
+ nz_time( 2011, 10, 21 ), # Hawkes' Bay Anniversary Day
112
+ nz_time( 2011, 11, 11 ), # Canterbury Anniversary Day
113
+ nz_time( 2011, 10, 31 ), # Marlborough Anniversary Day
114
+ nz_time( 2011, 12, 5 ), # Westland Anniversary Day
115
+ nz_time( 2011, 11, 28 ), # Chatham Islands Anniversary Day
116
+ nz_time( 2012, 1, 30 ), # Auckland Anniversary Day
117
+ nz_time( 2010, 11, 29 ), # Westland Anniversary Day
118
+ nz_time( 2011, 1, 31 ), # Auckland Anniversary Day
119
+ nz_time( 2010, 11, 12 ), # Canterbury Anniversary Day
120
+ nz_time( 2012, 3, 12 ), # Taranaki Anniversary Day
121
+ nz_time( 2012, 3, 26 ), # Otago Anniversary Day
122
+ nz_time( 2012, 9, 24 ), # South Canterbury Anniversary Day
123
+ nz_time( 2012, 10, 19 ), # Hawkes' Bay Anniversary Day
124
+ nz_time( 2012, 11, 16 ), # Canterbury Anniversary Day
125
+ nz_time( 2012, 10, 29 ), # Marlborough Anniversary Day
126
+ nz_time( 2013, 1, 28 ), # Auckland Anniversary Day
127
+ nz_time( 2012, 12, 3 ), # Westland Anniversary Day
128
+ nz_time( 2012, 12, 3 ), # Chatham Islands Anniversary Day
129
+ nz_time( 2013, 1, 21 ), # Wellington Anniversary Day
130
+ nz_time( 2013, 1, 21 ), # Southland Anniversary Day
131
+ nz_time( 2013, 2, 4 ), # Nelson Anniversary Day
132
+ nz_time( 2013, 3, 25 ), # Otago Anniversary Day
133
+ nz_time( 2012, 1, 23 ), # Wellington Anniversary Day
134
+ nz_time( 2012, 1, 16 ), # Southland Anniversary Day
135
+ nz_time( 2012, 1, 30 ), # Nelson Anniversary Day
136
+ nz_time( 2013, 11, 4 ), # Marlborough Anniversary Day
137
+ nz_time( 2013, 11, 15 ), # Canterbury Anniversary Day
138
+ nz_time( 2014, 1, 27 ), # Auckland Anniversary Day
139
+ nz_time( 2013, 12, 2 ), # Westland Anniversary Day
140
+ nz_time( 2013, 12, 2 ), # Chatham Islands Anniversary Day
141
+ nz_time( 2014, 1, 20 ), # Wellington Anniversary Day
142
+ nz_time( 2014, 4, 22 ), # Southland Anniversary Day
143
+ nz_time( 2014, 2, 3 ), # Nelson Anniversary Day
144
+ nz_time( 2014, 3, 10 ), # Taranaki Anniversary Day
145
+ nz_time( 2014, 3, 24 ), # Otago Anniversary Day
146
+ nz_time( 2013, 3, 11 ), # Taranaki Anniversary Day
147
+ nz_time( 2013, 9, 23 ), # South Canterbury Anniversary Day
148
+ nz_time( 2013, 10, 25 ), # Hawkes' Bay Anniversary Day
149
+ nz_time( 2010, 1, 4 ), # Day after New Year's Day Public Holiday for employees who would not normally work on Saturday
150
+ nz_time( 2010, 4, 25 ), # ANZAC Day
151
+ nz_time( 2010, 2, 6 ), # Waitangi Day
152
+ nz_time( 2011, 4, 25 ), # ANZAC Day
153
+ nz_time( 2011, 2, 6 ), # Waitangi Day
154
+ nz_time( 2014, 4, 25 ), # ANZAC Day
155
+ nz_time( 2013, 4, 25 ), # ANZAC Day
156
+ nz_time( 2014, 2, 6 ), # Waitangi Day
157
+ nz_time( 2010, 1, 2 ), # Day after New Year's Day (Public Holiday for employees who would normally work on Saturday)
158
+ nz_time( 2011, 1, 1 ), # New Year's Day (Public Holiday for employees who would normally work on Saturday)
159
+ nz_time( 2011, 1, 2 ), # Day after New Year's Day (Public Holiday for employees who would normally work on Sunday)
160
+ nz_time( 2012, 4, 25 ), # ANZAC Day
161
+ nz_time( 2012, 2, 6 ), # Waitangi Day
162
+ nz_time( 2013, 2, 6 ), # Waitangi Day
163
+ nz_time( 2014, 10, 27 ), # Labour Day
164
+ nz_time( 2014, 12, 25 ), # Christmas Day
165
+ nz_time( 2014, 6, 2 ), # Queen's Birthday
166
+ nz_time( 2015, 1, 1 ), # New Year's Day
167
+ nz_time( 2015, 4, 3 ), # Good Friday
168
+ nz_time( 2014, 12, 26 ), # Boxing Day
169
+ nz_time( 2015, 1, 2 ), # Day after New Year's Day
170
+ nz_time( 2015, 4, 6 ), # Easter Monday
171
+ nz_time( 2015, 12, 25 ), # Christmas Day
172
+ nz_time( 2015, 6, 1 ), # Queen's Birthday
173
+ nz_time( 2015, 10, 26 ), # Labour Day
174
+ nz_time( 2015, 12, 28 ), # Boxing Day (Public Holiday for employees who would not normally work on Saturday)
175
+ nz_time( 2016, 3, 25 ), # Good Friday
176
+ nz_time( 2016, 1, 1 ), # New Year's Day
177
+ nz_time( 2016, 1, 4 ), # Day after New Year's Day (Public Holiday for employees who would not normally work on Saturday)
178
+ nz_time( 2016, 3, 28 ), # Easter Monday
179
+ nz_time( 2016, 12, 25 ), # Christmas Day (Public Holiday for employees who would normally work on Sunday)
180
+ nz_time( 2016, 6, 6 ), # Queen's Birthday
181
+ nz_time( 2016, 10, 24 ), # Labour Day
182
+ nz_time( 2016, 12, 26 ), # Boxing Day
183
+ nz_time( 2016, 12, 27 ), # Christmas Day (Public Holiday for employees who would not normally work on Sunday)
184
+ nz_time( 2014, 10, 24 ), # Hawkes' Bay Anniversary Day
185
+ nz_time( 2014, 11, 14 ), # Canterbury Anniversary Day
186
+ nz_time( 2014, 9, 22 ), # South Canterbury Anniversary Day
187
+ nz_time( 2014, 11, 3 ), # Marlborough Anniversary Day
188
+ nz_time( 2014, 12, 1 ), # Westland Anniversary Day
189
+ nz_time( 2014, 12, 1 ), # Chatham Islands Anniversary Day
190
+ nz_time( 2015, 1, 19 ), # Wellington Anniversary Day
191
+ nz_time( 2015, 4, 7 ), # Southland Anniversary Day
192
+ nz_time( 2015, 1, 26 ), # Auckland Anniversary Day
193
+ nz_time( 2015, 3, 23 ), # Otago Anniversary Day
194
+ nz_time( 2015, 2, 2 ), # Nelson Anniversary Day
195
+ nz_time( 2015, 3, 9 ), # Taranaki Anniversary Day
196
+ nz_time( 2015, 10, 23 ), # Hawkes' Bay Anniversary Day
197
+ nz_time( 2015, 9, 28 ), # South Canterbury Anniversary Day
198
+ nz_time( 2015, 11, 2 ), # Marlborough Anniversary Day
199
+ nz_time( 2015, 11, 30 ), # Westland Anniversary Day
200
+ nz_time( 2015, 11, 13 ), # Canterbury Anniversary Day
201
+ nz_time( 2016, 1, 25 ), # Wellington Anniversary Day
202
+ nz_time( 2016, 3, 29 ), # Southland Anniversary Day
203
+ nz_time( 2015, 11, 30 ), # Chatham Islands Anniversary Day
204
+ nz_time( 2016, 2, 1 ), # Nelson Anniversary Day
205
+ nz_time( 2016, 2, 1 ), # Auckland Anniversary Day
206
+ nz_time( 2016, 3, 21 ), # Otago Anniversary Day
207
+ nz_time( 2016, 3, 14 ), # Taranaki Anniversary Day
208
+ nz_time( 2016, 9, 26 ), # South Canterbury Anniversary Day
209
+ nz_time( 2016, 10, 21 ), # Hawkes' Bay Anniversary Day
210
+ nz_time( 2016, 10, 31 ), # Marlborough Anniversary Day
211
+ nz_time( 2016, 11, 11 ), # Canterbury Anniversary Day
212
+ nz_time( 2016, 11, 28 ), # Westland Anniversary Day
213
+ nz_time( 2016, 11, 28 ), # Chatham Islands Anniversary Day
214
+ nz_time( 2015, 2, 6 ), # Waitangi Day
215
+ nz_time( 2015, 4, 25 ), # ANZAC Day
216
+ nz_time( 2016, 2, 6 ), # Waitangi Day
217
+ nz_time( 2016, 4, 25 ), # ANZAC Day
218
+ nz_time( 2016, 1, 2 ), # Day after New Year's Day (Public Holiday for employees who would normally work on Saturday)
219
+ nz_time( 2015, 12, 26 ), # Boxing Day (Public Holiday for employees who would normally work on Saturday)
220
+ nz_time( 2015, 4, 27 ), # ANZAC Day (Mondayised)
221
+ nz_time( 2016, 2, 8 ), # Waitangi Day (Mondayised)
222
+ nz_time( 2017, 1, 1 ), # New Year's Day (Public Holiday for employees who would normally work on Sunday)
223
+ nz_time( 2017, 1, 2 ), # Day after New Year's Day
224
+ nz_time( 2017, 1, 3 ), # New Year's Day (Public Holiday for employees who would not normally work on Sunday)
225
+ nz_time( 2017, 1, 23 ), # Wellington Anniversary
226
+ nz_time( 2017, 1, 30 ), # Auckland Anniversary
227
+ nz_time( 2017, 1, 30 ), # Nelson Anniversary
228
+ nz_time( 2017, 3, 13 ), # Taranaki Anniversary
229
+ nz_time( 2017, 2, 6 ), # Waitangi Day
230
+ nz_time( 2017, 3, 20 ), # Otago Anniversary
231
+ nz_time( 2017, 4, 14 ), # Good Friday
232
+ nz_time( 2017, 4, 17 ), # Easter Monday
233
+ nz_time( 2017, 4, 18 ), # Southland Anniversary
234
+ nz_time( 2017, 6, 5 ), # Queen's Birthday
235
+ nz_time( 2017, 9, 25 ), # Canterbury (South) Anniversary
236
+ nz_time( 2017, 4, 25 ), # ANZAC Day
237
+ nz_time( 2017, 10, 20 ), # Hawke's Bay Anniversary
238
+ nz_time( 2017, 10, 23 ), # Labour Day
239
+ nz_time( 2017, 10, 30 ), # Marlborough Anniversary
240
+ nz_time( 2017, 11, 27 ), # Chatham Islands Anniversary
241
+ nz_time( 2017, 11, 17 ), # Canterbury Anniversary
242
+ nz_time( 2017, 12, 4 ), # Westland Anniversary
243
+ nz_time( 2017, 12, 25 ), # Christmas Day
244
+ nz_time( 2017, 12, 26 ), # Boxing Day
245
+ nz_time( 2021, 12, 28 ), # Boxing Day (Public Holiday for employees who would not normally work on Sunday)
246
+ nz_time( 2021, 12, 26 ), # Boxing Day (Public Holiday for employees who would normally work on Sunday)
247
+ nz_time( 2021, 12, 27 ), # Christmas Day (Public Holiday for employees who would not normally work on Saturday)
248
+ nz_time( 2021, 12, 25 ), # Christmas Day (Public Holiday for employees who would normally work on Saturday)
249
+ nz_time( 2021, 11, 29 ), # Chatham Islands Anniversary
250
+ nz_time( 2021, 11, 29 ), # Westland Anniversary
251
+ nz_time( 2021, 11, 12 ), # Canterbury Anniversary
252
+ nz_time( 2021, 11, 1 ), # Marlborough Anniversary
253
+ nz_time( 2021, 10, 25 ), # Labour Day
254
+ nz_time( 2021, 10, 22 ), # Hawke's Bay Anniversary
255
+ nz_time( 2021, 9, 27 ), # Canterbury (South) Anniversary
256
+ nz_time( 2021, 6, 7 ), # Queen's Birthday
257
+ nz_time( 2021, 4, 26 ), # ANZAC Day (Mondayised)
258
+ nz_time( 2021, 4, 25 ), # ANZAC Day
259
+ nz_time( 2021, 4, 6 ), # Southland Anniversary
260
+ nz_time( 2021, 4, 5 ), # Easter Monday
261
+ nz_time( 2021, 4, 2 ), # Good Friday
262
+ nz_time( 2021, 3, 22 ), # Otago Anniversary
263
+ nz_time( 2021, 3, 8 ), # Taranaki Anniversary
264
+ nz_time( 2021, 2, 8 ), # Waitangi Day (Mondayised)
265
+ nz_time( 2021, 2, 6 ), # Waitangi Day
266
+ nz_time( 2021, 2, 1 ), # Nelson Anniversary
267
+ nz_time( 2021, 2, 1 ), # Auckland Anniversary
268
+ nz_time( 2021, 1, 25 ), # Wellington Anniversary
269
+ nz_time( 2021, 1, 4 ), # Day after New Year's Day (Public Holiday for employees who would not normally work on Saturday)
270
+ nz_time( 2021, 1, 2 ), # Day after New Year's Day (Public Holiday for employees who would normally work on Saturday)
271
+ nz_time( 2021, 1, 1 ), # New Year's Day
272
+ nz_time( 2020, 12, 28 ), # Boxing Day (Public Holiday for employees who would not normally work on Saturday)
273
+ nz_time( 2020, 12, 26 ), # Boxing Day (Public Holiday for employees who would normally work on Saturday)
274
+ nz_time( 2020, 12, 25 ), # Christmas Day
275
+ nz_time( 2020, 11, 30 ), # Chatham Islands Anniversary
276
+ nz_time( 2020, 11, 30 ), # Westland Anniversary
277
+ nz_time( 2020, 11, 13 ), # Canterbury Anniversary
278
+ nz_time( 2020, 11, 2 ), # Marlborough Anniversary
279
+ nz_time( 2020, 10, 26 ), # Labour Day
280
+ nz_time( 2020, 10, 23 ), # Hawke's Bay Anniversary
281
+ nz_time( 2020, 9, 28 ), # Canterbury (South) Anniversary
282
+ nz_time( 2020, 6, 1 ), # Queen's Birthday
283
+ nz_time( 2020, 4, 27 ), # ANZAC Day (Mondayised)
284
+ nz_time( 2020, 4, 25 ), # ANZAC Day
285
+ nz_time( 2020, 4, 14 ), # Southland Anniversary
286
+ nz_time( 2020, 4, 13 ), # Easter Monday
287
+ nz_time( 2020, 4, 10 ), # Good Friday
288
+ nz_time( 2020, 3, 23 ), # Otago Anniversary
289
+ nz_time( 2020, 3, 9 ), # Taranaki Anniversary
290
+ nz_time( 2020, 2, 6 ), # Waitangi Day
291
+ nz_time( 2020, 2, 3 ), # Nelson Anniversary
292
+ nz_time( 2020, 1, 27 ), # Auckland Anniversary
293
+ nz_time( 2020, 1, 20 ), # Wellington Anniversary
294
+ nz_time( 2020, 1, 2 ), # Day after New Year's Day
295
+ nz_time( 2020, 1, 1 ), # New Year's Day
296
+ nz_time( 2019, 12, 26 ), # Boxing Day
297
+ nz_time( 2019, 12, 25 ), # Christmas Day
298
+ nz_time( 2019, 12, 2 ), # Chatham Islands Anniversary
299
+ nz_time( 2019, 12, 2 ), # Westland Anniversary
300
+ nz_time( 2019, 11, 15 ), # Canterbury Anniversary
301
+ nz_time( 2019, 11, 4 ), # Marlborough Anniversary
302
+ nz_time( 2019, 10, 28 ), # Labour Day
303
+ nz_time( 2019, 10, 25 ), # Hawke's Bay Anniversary
304
+ nz_time( 2019, 9, 23 ), # Canterbury (South) Anniversary
305
+ nz_time( 2019, 6, 3 ), # Queen's Birthday
306
+ nz_time( 2019, 4, 25 ), # ANZAC Day
307
+ nz_time( 2019, 4, 23 ), # Southland Anniversary
308
+ nz_time( 2019, 4, 22 ), # Easter Monday
309
+ nz_time( 2019, 4, 19 ), # Good Friday
310
+ nz_time( 2019, 3, 25 ), # Otago Anniversary
311
+ nz_time( 2019, 3, 11 ), # Taranaki Anniversary
312
+ nz_time( 2019, 2, 6 ), # Waitangi Day
313
+ nz_time( 2019, 2, 4 ), # Nelson Anniversary
314
+ nz_time( 2019, 1, 28 ), # Auckland Anniversary
315
+ nz_time( 2019, 1, 21 ), # Wellington Anniversary
316
+ nz_time( 2019, 1, 2 ), # Day after New Year's Day
317
+ nz_time( 2019, 1, 1 ), # New Year's Day
318
+ nz_time( 2018, 12, 26 ), # Boxing Day
319
+ nz_time( 2018, 12, 25 ), # Christmas Day
320
+ nz_time( 2018, 12, 3 ), # Chatham Islands Anniversary
321
+ nz_time( 2018, 12, 3 ), # Westland Anniversary
322
+ nz_time( 2018, 11, 16 ), # Canterbury Anniversary
323
+ nz_time( 2018, 10, 29 ), # Marlborough Anniversary
324
+ nz_time( 2018, 10, 22 ), # Labour Day
325
+ nz_time( 2018, 10, 19 ), # Hawke's Bay Anniversary
326
+ nz_time( 2018, 9, 24 ), # Canterbury (South) Anniversary
327
+ nz_time( 2018, 6, 4 ), # Queen's Birthday
328
+ nz_time( 2018, 4, 25 ), # ANZAC Day
329
+ nz_time( 2018, 4, 3 ), # Southland Anniversary
330
+ nz_time( 2018, 4, 2 ), # Easter Monday
331
+ nz_time( 2018, 3, 30 ), # Good Friday
332
+ nz_time( 2018, 3, 26 ), # Otago Anniversary
333
+ nz_time( 2018, 3, 12 ), # Taranaki Anniversary
334
+ nz_time( 2018, 2, 6 ), # Waitangi Day
335
+ nz_time( 2018, 1, 29 ), # Nelson Anniversary
336
+ nz_time( 2018, 1, 29 ), # Auckland Anniversary
337
+ nz_time( 2018, 1, 22 ), # Wellington Anniversary
338
+ nz_time( 2018, 1, 2 ), # Day after New Year's Day
339
+ nz_time( 2018, 1, 1 ), # New Year's Day
340
+ ]
341
+
342
+ ANNIVERSARIES = [
343
+ nz_time( 2008, 12, 1 ), # Westland Anniversary Day
344
+ nz_time( 2008, 12, 1 ), # Chatham Islands Anniversary Day
345
+ nz_time( 2009, 1, 26 ), # Auckland Anniversary Day
346
+ nz_time( 2009, 1, 19 ), # Wellington Anniversary Day
347
+ nz_time( 2009, 2, 2 ), # Nelson Anniversary Day
348
+ nz_time( 2009, 1, 19 ), # Southland Anniversary Day
349
+ nz_time( 2009, 3, 9 ), # Taranaki Anniversary Day
350
+ nz_time( 2009, 9, 28 ), # South Canterbury Anniversary Day
351
+ nz_time( 2009, 11, 13 ), # Canterbury Anniversary Day
352
+ nz_time( 2009, 11, 30 ), # Chatham Islands Anniversary Day
353
+ nz_time( 2010, 1, 25 ), # Wellington Anniversary Day
354
+ nz_time( 2009, 11, 30 ), # Westland Anniversary Day
355
+ nz_time( 2010, 2, 1 ), # Auckland Anniversary Day
356
+ nz_time( 2010, 3, 8 ), # Taranaki Anniversary Day
357
+ nz_time( 2010, 1, 18 ), # Southland Anniversary Day
358
+ nz_time( 2010, 2, 1 ), # Nelson Anniversary Day
359
+ nz_time( 2010, 9, 27 ), # South Canterbury Anniversary Day
360
+ nz_time( 2010, 3, 22 ), # Otago Anniversary Day
361
+ nz_time( 2010, 11, 1 ), # Marlborough Anniversary Day
362
+ nz_time( 2010, 10, 22 ), # Hawkes' Bay Anniversary Day
363
+ nz_time( 2009, 3, 23 ), # Otago Anniversary Day
364
+ nz_time( 2009, 11, 2 ), # Marlborough Anniversary Day
365
+ nz_time( 2009, 10, 23 ), # Hawkes' Bay Anniversary Day
366
+ nz_time( 2010, 11, 29 ), # Chatham Islands Anniversary Day
367
+ nz_time( 2011, 1, 31 ), # Nelson Anniversary Day
368
+ nz_time( 2011, 1, 17 ), # Southland Anniversary Day
369
+ nz_time( 2011, 1, 24 ), # Wellington Anniversary Day
370
+ nz_time( 2011, 3, 14 ), # Taranaki Anniversary Day
371
+ nz_time( 2011, 9, 26 ), # South Canterbury Anniversary Day
372
+ nz_time( 2011, 3, 21 ), # Otago Anniversary Day
373
+ nz_time( 2011, 10, 21 ), # Hawkes' Bay Anniversary Day
374
+ nz_time( 2011, 11, 11 ), # Canterbury Anniversary Day
375
+ nz_time( 2011, 10, 31 ), # Marlborough Anniversary Day
376
+ nz_time( 2011, 12, 5 ), # Westland Anniversary Day
377
+ nz_time( 2011, 11, 28 ), # Chatham Islands Anniversary Day
378
+ nz_time( 2012, 1, 30 ), # Auckland Anniversary Day
379
+ nz_time( 2010, 11, 29 ), # Westland Anniversary Day
380
+ nz_time( 2011, 1, 31 ), # Auckland Anniversary Day
381
+ nz_time( 2010, 11, 12 ), # Canterbury Anniversary Day
382
+ nz_time( 2012, 3, 12 ), # Taranaki Anniversary Day
383
+ nz_time( 2012, 3, 26 ), # Otago Anniversary Day
384
+ nz_time( 2012, 9, 24 ), # South Canterbury Anniversary Day
385
+ nz_time( 2012, 10, 19 ), # Hawkes' Bay Anniversary Day
386
+ nz_time( 2012, 11, 16 ), # Canterbury Anniversary Day
387
+ nz_time( 2012, 10, 29 ), # Marlborough Anniversary Day
388
+ nz_time( 2013, 1, 28 ), # Auckland Anniversary Day
389
+ nz_time( 2012, 12, 3 ), # Westland Anniversary Day
390
+ nz_time( 2012, 12, 3 ), # Chatham Islands Anniversary Day
391
+ nz_time( 2013, 1, 21 ), # Wellington Anniversary Day
392
+ nz_time( 2013, 1, 21 ), # Southland Anniversary Day
393
+ nz_time( 2013, 2, 4 ), # Nelson Anniversary Day
394
+ nz_time( 2013, 3, 25 ), # Otago Anniversary Day
395
+ nz_time( 2012, 1, 23 ), # Wellington Anniversary Day
396
+ nz_time( 2012, 1, 16 ), # Southland Anniversary Day
397
+ nz_time( 2012, 1, 30 ), # Nelson Anniversary Day
398
+ nz_time( 2013, 11, 4 ), # Marlborough Anniversary Day
399
+ nz_time( 2013, 11, 15 ), # Canterbury Anniversary Day
400
+ nz_time( 2014, 1, 27 ), # Auckland Anniversary Day
401
+ nz_time( 2013, 12, 2 ), # Westland Anniversary Day
402
+ nz_time( 2013, 12, 2 ), # Chatham Islands Anniversary Day
403
+ nz_time( 2014, 1, 20 ), # Wellington Anniversary Day
404
+ nz_time( 2014, 4, 22 ), # Southland Anniversary Day
405
+ nz_time( 2014, 2, 3 ), # Nelson Anniversary Day
406
+ nz_time( 2014, 3, 10 ), # Taranaki Anniversary Day
407
+ nz_time( 2014, 3, 24 ), # Otago Anniversary Day
408
+ nz_time( 2013, 3, 11 ), # Taranaki Anniversary Day
409
+ nz_time( 2013, 9, 23 ), # South Canterbury Anniversary Day
410
+ nz_time( 2013, 10, 25 ), # Hawkes' Bay Anniversary Day
411
+ nz_time( 2014, 10, 24 ), # Hawkes' Bay Anniversary Day
412
+ nz_time( 2014, 11, 14 ), # Canterbury Anniversary Day
413
+ nz_time( 2014, 9, 22 ), # South Canterbury Anniversary Day
414
+ nz_time( 2014, 11, 3 ), # Marlborough Anniversary Day
415
+ nz_time( 2014, 12, 1 ), # Westland Anniversary Day
416
+ nz_time( 2014, 12, 1 ), # Chatham Islands Anniversary Day
417
+ nz_time( 2015, 1, 19 ), # Wellington Anniversary Day
418
+ nz_time( 2015, 4, 7 ), # Southland Anniversary Day
419
+ nz_time( 2015, 1, 26 ), # Auckland Anniversary Day
420
+ nz_time( 2015, 3, 23 ), # Otago Anniversary Day
421
+ nz_time( 2015, 2, 2 ), # Nelson Anniversary Day
422
+ nz_time( 2015, 3, 9 ), # Taranaki Anniversary Day
423
+ nz_time( 2015, 10, 23 ), # Hawkes' Bay Anniversary Day
424
+ nz_time( 2015, 9, 28 ), # South Canterbury Anniversary Day
425
+ nz_time( 2015, 11, 2 ), # Marlborough Anniversary Day
426
+ nz_time( 2015, 11, 30 ), # Westland Anniversary Day
427
+ nz_time( 2015, 11, 13 ), # Canterbury Anniversary Day
428
+ nz_time( 2016, 1, 25 ), # Wellington Anniversary Day
429
+ nz_time( 2016, 3, 29 ), # Southland Anniversary Day
430
+ nz_time( 2015, 11, 30 ), # Chatham Islands Anniversary Day
431
+ nz_time( 2016, 2, 1 ), # Nelson Anniversary Day
432
+ nz_time( 2016, 2, 1 ), # Auckland Anniversary Day
433
+ nz_time( 2016, 3, 21 ), # Otago Anniversary Day
434
+ nz_time( 2016, 3, 14 ), # Taranaki Anniversary Day
435
+ nz_time( 2016, 9, 26 ), # South Canterbury Anniversary Day
436
+ nz_time( 2016, 10, 21 ), # Hawkes' Bay Anniversary Day
437
+ nz_time( 2016, 10, 31 ), # Marlborough Anniversary Day
438
+ nz_time( 2016, 11, 11 ), # Canterbury Anniversary Day
439
+ nz_time( 2016, 11, 28 ), # Westland Anniversary Day
440
+ nz_time( 2016, 11, 28 ), # Chatham Islands Anniversary Day
441
+ nz_time( 2017, 1, 23 ), # Wellington Anniversary
442
+ nz_time( 2017, 1, 30 ), # Auckland Anniversary
443
+ nz_time( 2017, 1, 30 ), # Nelson Anniversary
444
+ nz_time( 2017, 3, 13 ), # Taranaki Anniversary
445
+ nz_time( 2017, 3, 20 ), # Otago Anniversary
446
+ nz_time( 2017, 4, 18 ), # Southland Anniversary
447
+ nz_time( 2017, 9, 25 ), # Canterbury (South) Anniversary
448
+ nz_time( 2017, 10, 20 ), # Hawke's Bay Anniversary
449
+ nz_time( 2017, 10, 30 ), # Marlborough Anniversary
450
+ nz_time( 2017, 11, 27 ), # Chatham Islands Anniversary
451
+ nz_time( 2017, 11, 17 ), # Canterbury Anniversary
452
+ nz_time( 2017, 12, 4 ), # Westland Anniversary
453
+ nz_time( 2021, 11, 29 ), # Chatham Islands Anniversary
454
+ nz_time( 2021, 11, 29 ), # Westland Anniversary
455
+ nz_time( 2021, 11, 12 ), # Canterbury Anniversary
456
+ nz_time( 2021, 11, 1 ), # Marlborough Anniversary
457
+ nz_time( 2021, 10, 22 ), # Hawke's Bay Anniversary
458
+ nz_time( 2021, 9, 27 ), # Canterbury (South) Anniversary
459
+ nz_time( 2021, 4, 6 ), # Southland Anniversary
460
+ nz_time( 2021, 3, 22 ), # Otago Anniversary
461
+ nz_time( 2021, 3, 8 ), # Taranaki Anniversary
462
+ nz_time( 2021, 2, 1 ), # Nelson Anniversary
463
+ nz_time( 2021, 2, 1 ), # Auckland Anniversary
464
+ nz_time( 2021, 1, 25 ), # Wellington Anniversary
465
+ nz_time( 2020, 11, 30 ), # Chatham Islands Anniversary
466
+ nz_time( 2020, 11, 30 ), # Westland Anniversary
467
+ nz_time( 2020, 11, 13 ), # Canterbury Anniversary
468
+ nz_time( 2020, 11, 2 ), # Marlborough Anniversary
469
+ nz_time( 2020, 10, 23 ), # Hawke's Bay Anniversary
470
+ nz_time( 2020, 9, 28 ), # Canterbury (South) Anniversary
471
+ nz_time( 2020, 4, 14 ), # Southland Anniversary
472
+ nz_time( 2020, 3, 23 ), # Otago Anniversary
473
+ nz_time( 2020, 3, 9 ), # Taranaki Anniversary
474
+ nz_time( 2020, 2, 3 ), # Nelson Anniversary
475
+ nz_time( 2020, 1, 27 ), # Auckland Anniversary
476
+ nz_time( 2020, 1, 20 ), # Wellington Anniversary
477
+ nz_time( 2019, 12, 2 ), # Chatham Islands Anniversary
478
+ nz_time( 2019, 12, 2 ), # Westland Anniversary
479
+ nz_time( 2019, 11, 15 ), # Canterbury Anniversary
480
+ nz_time( 2019, 11, 4 ), # Marlborough Anniversary
481
+ nz_time( 2019, 10, 25 ), # Hawke's Bay Anniversary
482
+ nz_time( 2019, 9, 23 ), # Canterbury (South) Anniversary
483
+ nz_time( 2019, 4, 23 ), # Southland Anniversary
484
+ nz_time( 2019, 3, 25 ), # Otago Anniversary
485
+ nz_time( 2019, 3, 11 ), # Taranaki Anniversary
486
+ nz_time( 2019, 2, 4 ), # Nelson Anniversary
487
+ nz_time( 2019, 1, 28 ), # Auckland Anniversary
488
+ nz_time( 2019, 1, 21 ), # Wellington Anniversary
489
+ nz_time( 2018, 12, 3 ), # Chatham Islands Anniversary
490
+ nz_time( 2018, 12, 3 ), # Westland Anniversary
491
+ nz_time( 2018, 11, 16 ), # Canterbury Anniversary
492
+ nz_time( 2018, 10, 29 ), # Marlborough Anniversary
493
+ nz_time( 2018, 10, 19 ), # Hawke's Bay Anniversary
494
+ nz_time( 2018, 9, 24 ), # Canterbury (South) Anniversary
495
+ nz_time( 2018, 4, 3 ), # Southland Anniversary
496
+ nz_time( 2018, 3, 26 ), # Otago Anniversary
497
+ nz_time( 2018, 3, 12 ), # Taranaki Anniversary
498
+ nz_time( 2018, 1, 29 ), # Nelson Anniversary
499
+ nz_time( 2018, 1, 29 ), # Auckland Anniversary
500
+ nz_time( 2018, 1, 22 ), # Wellington Anniversary
501
+ ]
502
+
503
+ def self.nz_public_holiday?(query)
504
+ !!HOLIDAYS.find do |hol|
505
+ hol.year == query.year && hol.month == query.month && hol.day == query.day
506
+ end
507
+ end
508
+
509
+ def self.nz_anniversary?(query)
510
+ !!ANNIVERSARIES.find do |hol|
511
+ hol.year == query.year && hol.month == query.month && hol.day == query.day
512
+ end
513
+ end
514
+
515
+ end
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "nzholidays/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "nzholidays"
8
+ spec.version = Nzholidays::VERSION
9
+ spec.authors = ["Carl Douglas"]
10
+ spec.email = ["105003+carld@users.noreply.github.com"]
11
+
12
+ spec.summary = %q{New Zealand Public Holidays}
13
+ spec.description = %q{New Zealand Public Holidays}
14
+ spec.homepage = "https://github.com/carld/nzholidays"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_dependency "icalendar"
25
+ spec.add_dependency "tzinfo"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.16"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nzholidays
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Carl Douglas
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-12-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: icalendar
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: tzinfo
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '10.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
83
+ description: New Zealand Public Holidays
84
+ email:
85
+ - 105003+carld@users.noreply.github.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
+ - CODE_OF_CONDUCT.md
94
+ - Gemfile
95
+ - LICENSE.txt
96
+ - README.md
97
+ - Rakefile
98
+ - bin/console
99
+ - bin/setup
100
+ - lib/nzholidays.rb
101
+ - lib/nzholidays/template.erb
102
+ - lib/nzholidays/version.rb
103
+ - nzholidays.gemspec
104
+ homepage: https://github.com/carld/nzholidays
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.6.13
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: New Zealand Public Holidays
128
+ test_files: []