Hard fork holidays/holidays gem into plugin.

The original gem does not seem to be maintained anymore so we're pulling
this into the plugin so that we can update the definitions easily.
This commit is contained in:
Alan Guo Xiang Tan 2021-06-01 10:49:48 +08:00
parent 5c40a95c85
commit 0e3431f111
376 changed files with 40045 additions and 4 deletions

View File

@ -8,8 +8,6 @@ module Jobs
return unless SiteSetting.calendar_enabled return unless SiteSetting.calendar_enabled
return unless topic_id = SiteSetting.holiday_calendar_topic_id.presence return unless topic_id = SiteSetting.holiday_calendar_topic_id.presence
require "holidays" unless defined?(Holidays)
regions_and_user_ids = Hash.new { |h, k| h[k] = [] } regions_and_user_ids = Hash.new { |h, k| h[k] = [] }
UserCustomField UserCustomField

View File

@ -5,7 +5,6 @@ UNUSED_REGIONS = ["ecbtarget", "federalreserve", "federalreservebanks", "fedex",
HOLIDAYS_COUNTRY_OVERRIDES = { "gr" => "el" } HOLIDAYS_COUNTRY_OVERRIDES = { "gr" => "el" }
task 'javascript:update_constants' => :environment do task 'javascript:update_constants' => :environment do
require 'holidays'
holiday_regions = Holidays.available_regions.map(&:to_s) - UNUSED_REGIONS holiday_regions = Holidays.available_regions.map(&:to_s) - UNUSED_REGIONS
time_zone_to_region = {} time_zone_to_region = {}

View File

@ -6,7 +6,10 @@
# author: Daniel Waterworth, Joffrey Jaffeux # author: Daniel Waterworth, Joffrey Jaffeux
# url: https://github.com/discourse/discourse-calendar # url: https://github.com/discourse/discourse-calendar
gem 'holidays', '8.4.1', require: false if !Rails.env.production? || Sidekiq.server?
require File.join(File.dirname(__FILE__), "vendor/holidays/lib/holidays")
end
gem 'rrule', '0.4.2', require: false gem 'rrule', '0.4.2', require: false
load File.expand_path('../lib/calendar_settings_validator.rb', __FILE__) load File.expand_path('../lib/calendar_settings_validator.rb', __FILE__)

416
vendor/holidays/CHANGELOG.md vendored Normal file
View File

@ -0,0 +1,416 @@
# Ruby Holidays Gem CHANGELOG
## 8.4.1
* Fix jp holidays from 2022.
## 8.4.0
* Update submodule definitions.
* Thanks to contributors!!
## 8.3.0
* Update submodule definitions.
* Remove test about feb 29 on non leap year.
* Thanks to contributors!!
## 8.2.0
* Update submodule definitions. Thanks to contributors!!
## 8.1.0
* Update submodule definitions, so that the newest holidays from the definition
gem are represent here.
## 8.0.0
* Remove support for ruby 2.2 and ruby 2.3.
* Add support for latest ruby 2.6
* Update to [v5.0.1 definitions](https://github.com/holidays/definitions/releases/tag/v5.0.1). Please see the changelog for the definition details.
## 7.1.0
* Update to [v4.1.0 definitions](https://github.com/holidays/definitions/releases/tag/v4.1.0). Please see the changelog for the definition details.
## 7.0.0
Major semver bump due to the major version change in the [definitions](https://github.com/holidays/definitions/blob/master/CHANGELOG.md#400). Several non ISO regions have been modified in order to provide more clarity for parent and sub-regions.
Affected regions:
* `ecb_target` region changed to `ecbtarget`
* `federal_reserve` region changed to `federalreserve`
* `federalreservebanks` region changed to `federalreservebanks`
* `north_america_informal` region changed to `northamericainformal`
* `united_nations` region changed to `unitednations`
* `north_america` region changed to `northamerica`
* `south_america` region changed to `southamerica`
Please see the [definitions v4.0.0 CHANGELOG](https://github.com/holidays/definitions/blob/master/CHANGELOG.md#400) for the full change list.
## 6.6.1
* Fixes `any_holidays_during_work_week?` so that it actually does what it says it does [issue-264](https://github.com/holidays/holidays/issues/264)
## 6.6.0
* Update to [v3.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v3.0.0). This required updates to the custom method parser but no behavior changes.
* Remove unused `simplecov-rcov` from gemspec dev dependencies
* Fix parent region loading bug [PR](https://github.com/holidays/holidays/pull/320) (thanks to chadrschroeder)
* Fix `ruby-head` build caused by new 'endless range' feature in ruby 2.6.0 [PR](https://github.com/holidays/holidays/pull/321)
* Refactor definition search logic for improved readability [PR](https://github.com/holidays/holidays/pull/318) (thanks to https://github.com/guizma)
* Reorganize most documentation into the `docs/` directory
* Fix list of covered rubies in README
## 6.5.0
* Update to [v2.5.2 definitions](https://github.com/holidays/definitions/releases/tag/v2.5.2). Please see the changelog for the definition details.
* Fix permissions on `bin` executables (thanks to github.com/JuanitoFatas)
## 6.4.0
* Update to [v2.4.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.4.0). Please see the changelog for the definition details.
## 6.3.0
* Update to [v2.3.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.3.0). Please see the changelog for the definition details.
## 6.2.0
* Update to [v2.2.1 definitions](https://github.com/holidays/definitions/releases/tag/v2.2.1). Please see the changelog for the definition details.
* README update to add `:federal_reserve` examples (thanks to https://github.com/aahmad)
## 6.1.0
* Update to [v2.1.1 definitions](https://github.com/holidays/definitions/releases/tag/v2.1.1). Please see the changelog for
the definitions for details.
## 6.0.0
* Remove support for ruby 2.1.0 since it is [no longer officially supported](https://www.ruby-lang.org/en/news/2017/04/01/support-of-ruby-2-1-has-ended/). This is the cause of the major
version bump.
* Update to [v2.0.0 definitions](https://github.com/holidays/definitions/releases/tag/v2.0.0). This changes the format
of definition tests and requires the other changes.
* Rewrite test generation logic to consume new YAML format.
To be crystal clear: this version should not behave differently in terms of holiday results than v5.7.0 of the gem. Any
differences are a bug that should be addressed.
## 5.7.0
* Update to [v1.7.1 definitions](https://github.com/holidays/definitions/releases/tag/v1.7.1). Please see the
definitions repository for the list of changes.
* Remove 'coveralls'. We never looked at the reports. We will we simplecov to enforce test coverage. It will
start off being set to require 99% and above.
## 5.6.0
* Update to v1.6.1 definitions, which includes updates for the `:ca` region (and subregions)
## 5.5.1
* Update to v1.5.1 definitions, which includes bugfix in `fedex` custom method
## 5.5.0
* Fix [#251](https://github.com/holidays/holidays/issues/251): `load_custom` would override all other definitions
* Fix [#266](https://github.com/holidays/holidays/issues/266): `:any` does not return expected results
* Fix [#265](https://github.com/holidays/holidays/issues/265): Jersey/je not loaded as expected when pulling `:gb`
* Add lunar date calculations, which are used in `:kr` and `:vi` definitions (thanks to https://github.com/jonathanpike)
* Improve cache performance (thanks to https://github.com/mzruya)
* Remove incorrect comments in definition generation (thanks to https://github.com/morrme)
* Fix bug related to definition functions inadvertently affecting subsequent date calculations
* Point to latest version (1.5.0) of definitions, which includes:
* Add Vietnamese holidays
* Updates Australian holidays
* Updates Korean holidays to use native language and fancy lunar date calculations
* Fix NYSE definitions to correctly calculate observed "New Year's Day"
## 5.4.0
* Add support for ruby 2.4.0 (added it to the required tests in Travis CI)
* Fix issue [#250](https://github.com/holidays/holidays/issues/250), which was that subregions were 'lost' if there was more than one underscore in it (thanks to https://github.com/chinito)
* Fix caching when using Date extensions (thanks to https://github.com/alexgerstein)
* Remove unused weekend date calculator method (thanks to https://github.com/ttwo32)
* Use FULL_DEFINITIONS_PATH when loading definitions to avoid NameErrors when iterating whole LOAD_PATH (thanks to https://github.com/burke)
* Point to latest version (1.3.0) of definitions, which includes:
* Add Tunisian (tn) holidays (thanks to https://github.com/achr3f)
* Corrects various Australian holidays
* Update certain German regions for accuracy
* Change 'yk' to 'yt'
## 5.3.0
* Fix `ca` province/territory codes for 'Newfoundland and Labrador' and 'Yukon' (thanks to https://github.com/slucaskim)
## 5.2.1
* Fix caching (i.e. calls to `cache_between`) to...you know, actually cache correctly and give
performance improvements. Thanks to https://github.com/AnotherJoSmith for the fix!
## 5.2.0
* Point to latest (v1.2.0 of definitions)
* updates `jp` defs to fix 'Foundation Day' name
* Fix `ca` defs for observed holidays
* Update `au` defs to have Christmas and Boxing Day for all of Australia instead of just individual territories
* Update `ie` defs to consolidate St Stephen's Day to use common method instead of custom method
## 5.1.0
* Add `load_all` method to `Holidays` namespace to preload all definitions (i.e. no lazy loading)
* Fix issue-234: correctly load available regions so there is no error on `Holidays.available_regions` call
## 5.0.0
* Remove support for jruby 1.7 (this is the main reason for the major semver bump)
* Remove support for ruby 2.0 (since it is no longer being supported by the core ruby team)
* Add back the lazy loading of regions (this was removed in the 4.0.0 bump) instead of loading upon require (this should have
no outward repercussions for users)
* Move definitions into their own repository and add as submodule. This will allow for more flexibility for tools written
in other languages.
* Rename `DateCalculatorFactory` to `Factory::DateCalculator`
## 4.7.0
* Fix issue-225 (`LocalJumpError` for certain `jp` definition combinations) (https://github.com/ttwo32)
* Add Korean Lunar holidays (https://github.com/jonathanpike)
## 4.6.0
* Add holidays for 'Luxembourg' (https://github.com/dunyakirkali)
## 4.5.0
* Add `Holidays.year_holidays` method to obtain all holidays occuring from date to end of year, inclusively (thanks to https://github.com/jonathanpike)
## 4.4.0
* Add Peruvian holiday definitions (https://github.com/Xosmond)
## 4.3.0
* Update Portuguese holidays to restore 4 holidays (https://github.com/ruippeixotog)
## 4.2.0
* BUGFIX Issue-194: correctly calculate `next_holidays` if next holiday is far in the future
* Give dutch holidays their proper names (https://github.com/Qqwy)
## 4.1.0
* Issue-161: correctly report St Andrews Day as informal 2006 and earlier in `gb_sct`
* Issue-169: set correct years of observance for Family Day in various `ca` provinces
* Issue-163: Add `next_holidays` method. See README for usage (https://github.com/ttwo32)
## 4.0.0
Major refactor with breaking changes! Sorry for the wall of text but there is a lot of info here.
* Fixes issue 144 (loading custom defs with methods). This was the refactor catalyst. Changes highlights include:
- Allow for custom methods added via the `load_custom` method to be used immediately as expected
- Consolidate and clarify custom method parsing and validation
- Change nearly every definition to use new 'custom method' YAML format. See `definitions/README.md` for more info.
- Remove `require` functionality when loading new definitions, instead using in-memory repositories. See below for info.
- Now loads all generated definitions when `require 'holidays'` is called. See below for performance info.
* Add `rake console` command for easier local testing
* Remove or rename many public methods that were never intended for public use:
- Remove following date calculation helper methods (definitions must now directly call factory):
- `easter`
- `orthodox_easter`
- `orthodox_easter_julian`
- `to_monday_if_sunday`
- `to_monday_if_weekend`
- `to_weekday_if_boxing_weekend`
- `to_weekday_if_boxing_weekend_from_year`
- `to_weekday_if_weekend`
- `calculate_day_of_month`
- Remove `available` method. This was only intended for internal use
- Remove `parse_definition_files_and_return_source`. This was only intended for internal use
- Remove `load_all` method. This was only intended for internal use
- Rename `regions` to `available_regions` for clarity
- Rename `full_week?` to `any_holidays_during_work_week?` for clarity
* Following methods now constitute the 'public API' of this gem:
- `on`
- `any_holidays_during_work_week?` (renamed method, was originally `full_week?`, same behavior as before)
- `between`
- `cache_between`
- `available_regions` (renamed method, was originally `regions`, same behavior as before)
- `load_custom`
* All generated definitions are now loaded when `require 'holidays'` is called
- Previously files were required 'on the fly' when a specific region was specified. By requiring all definitions upon
startup we greatly simplify the handling of regions, definitions, and custom methods internally
- This results in a performance hit when calling `require 'holidays'`. Here is an example based on my benchmarking:
- old: `0.045537`
- new: `0.145125`
I decided that this performance hit on startup is acceptable. All other performance should remain the same. If performance is
a major concern please open an issue so we can discuss your use case.
## 3.3.0
This is the final minor point release in v3.X.X. I am releasing it so that all of the latest definitions can be
used by anyone that is not ready to jump to version 4.0.0. I am not planning on supporting this version unless a major
issue is found that needs to be immediately addressed.
* Update public holidays for Argentina (https://github.com/schmierkov)
* Remove redundant `require` from weekend modifier (https://github.com/Eric-Guo)
* FIX: Easter Saturday not a holiday in NZ (https://github.com/ghiculescu)
* FIX: Japan 'Marine Day' for 1996-2002 year ranges (https://github.com/shuhei)
* FIX: Australia calculations for Christmas and Boxing (https://github.com/ghiculescu)
* Add dutch language version of definitions for Belgium (michael.cox@novalex.be)
* Make 'Goede Vrijdag' informal for NL definitions (https://github.com/MathijsK93)
* Add 'Great Friday' to Czech holidays (juris@uol.cz)
* Add new informal holidays for Germany (https://github.com/knut2)
* FIX: correctly check for new `year_range` attribute in holidays by month repository (https://github.com/knut2)
* Add DE-Reformationstag for 2017 (https://github.com/knut2)
* Update Australia QLD definition Queens Bday and Labour Day (https://github.com/ghiculescu)
## 3.2.0
* add 'valid year' functionality to definitions - https://github.com/holidays/holidays/issues/33 - (thanks to https://github.com/ttwo32)
* Fix 'day after thanksgiving' namespace bug during definition generation (thanks to https://github.com/ttwo32)
* fix Danish holidays 'palmesondag and 1/5 (danish fightday)' to set to informal (thanks to https://github.com/bjensen)
## 3.1.2
* Do not require Date monkeypatching in definitions to use mday calculations (thanks to https://github.com/CloCkWeRX)
## 3.1.1
* Require 'digest/md5' in main 'holidays' module. This was missed during the refactor (thanks to https://github.com/espen)
## 3.1.0
* Fix St. Stephen observance holiday for Ireland (https://github.com/gumchum)
* Add Bulgarian holidays (https://github.com/thekazak)
* Add new mountain holiday for Japan (https://github.com/ttwo32)
* Add ability to calculate Easter in either Gregorian (existing) or Julian (new) dates
## 3.0.0
* Major refactor! Lots of code moved around and some methods were removed from the public api (they were never intended to be public).
* Only supports ruby 2.0.0 and up. Travis config has been updated to reflect this.
* Moves 'date' monkeypatching out of main lib and makes it a core extension. See README for usage.
* Fixes remote execution bug in issue-86 (thanks to https://github.com/Intrepidd for reporting)
* No region definition changes.
I decided to make this a major version bump due to how much I changed. I truly hope no one will notice.
See the README for the usage. It has, except for the date core extension, not changed.
## 2.2.0
* Correct 'informal' type for Dodenherdenking holiday in NL definitions (https://github.com/MathijsK93)
## 2.1.0
* Updated Slovak holiday definitions (https://github.com/guitarman)
* Fix Japanese non-Monday substitute holidays (https://github.com/shuhei)
* Fixed typo in Slovak holiday definitions (https://github.com/martinsabo)
* Updated New Zealand definitions to reflect new weekend-to-monday rules (https://github.com/SebastianEdwards)
* Fix Australian definitions (https://github.com/ghiculescu)
## 2.0.0
* Add test coverage
* Remove support for Ruby 1.8.7 and REE. (https://github.com/itsmechlark)
* Add support for Ruby 2.2 (https://github.com/itsmechlark)
* Add PH holidays (https://github.com/itsmechlark)
* Belgian holidays now written in French instead of English (https://github.com/maximerety)
* Update California (USA) holidays to include Cesar Chavez and Thanksgiving (https://github.com/evansagge)
## 1.2.0
* Remove inauguration day from USA Federal Reserve definitions (https://github.com/aripollak)
* Add caching functionality for date ranges (https://github.com/ndbroadbent & https://github.com/ghiculescu)
## 1.1.0
* Add support to load custom holidays on the fly
* Add hobart & launceston show days (https://github.com/ghiculescu)
* Add Melbourne Cup day (https://github.com/ghiculescu)
* Add Hobart Regatte Day (https://github.com/ghiculescu)
* Add Costa Rican holidays (https://github.com/kevinwmerritt)
* Update Canadian Holidays (https://github.com/KevinBrowne)
* Add substitute holidays for Japan (https://github.com/YoshiyukiHirano)
* Fix USA Federal Reserve Holidays
* Add FedEx holidays (https://github.com/adamrunner)
## 1.0.7
* Load parent region even when sub region is not explicitly defined (https://github.com/csage)
* Full support for http://en.wikipedia.org/wiki/ISO_3166-2:DE (https://github.com/rojoko)
* Added Lithuanian definitions (https://github.com/Brunas)
* Added Chilean definitions (https://github.com/marcelo-soto)g
* Added European Central Bank TARGET definitions (Toby Bryans, NASDAQ OMX NLX)
* FR: Make Pâques and Pentecôte informal holidays (https://github.com/wizcover)
* NL: Update for the new King (https://github.com/johankok)
* Added Slovenian definitions (https://github.com/bbalon)
## 1.0.6
* Added `Holidays.regions` method (https://github.com/sonnym)
* Added Slovakian definitions (https://github.com/mirelon)
* Added Venezuelan definitions (https://github.com/Chelo)
* Updated Canadian definitions (https://github.com/sdavies)
* Updated Argentinian definitions (https://github.com/popox)
* Updated Australian definitions (https://github.com/ghiculescu)
* Updated Portuguese definitions (https://github.com/MiPereira)
* Added Swiss definitions (https://github.com/samzurcher, https://github.com/jg)
* Added Romanian definitions (https://github.com/mtarnovan)
* Added Belgian definitions (https://github.com/jak78)
* Added Moroccan definitions (https://github.com/jak78)
* Fixes for New Year's and Boxing Day (https://github.com/iterion, https://github.com/andyw8)
* Fixes for Father's Day, Mother's Day and Armed Forces Day (https://github.com/eheikes)
* Typos (https://github.com/gregoriokusowski, https://github.com/popox)
* Added Croatian definitions (https://github.com/lecterror)
* Added US Federal Reserve holidays (https://github.com/willbarrett)
* Added NERC holidays (https://github.com/adamstrickland)
* Updated Irish holidays (https://github.com/xlcrs)
## 1.0.5
* Added `full_week?` method (https://github.com/dceddia)
* Added Portuguese definitions (https://github.com/pmor)
* Added Hungarian definitions (https://github.com/spap)
* Typos (https://github.com/DenisKnauf)
## 1.0.4
* Add Liechtenstein holiday defs (mercy vielmal Bernhard Furtmueller)
## 1.0.3
* Add Austrian holiday definitions (thanks to Vogel Siegfried)
## 1.0.2
* Add `orthodox_easter` method and Greek holiday definitions (thanks https://github.com/ddimitriadis)
## 1.0.0
* Support calculating mday from negative weeks other than -1 (thanks https://github.com/bjeanes)
* Use class method to check leap years and fixed bug in Date.calculate_mday (thanks https://github.com/dgrambow)
* Added Czech (thanks https://github.com/boblin), Brazilian (https://github.com/fabiokr), Norwegian (thanks to Peter Skeide) and Australia/Brisbane (https://github.com/bjeanes) definitions
* Cleaned up rake and gemspec
## 0.9.3
* Added New York Stock Exchange holidays (thank you Alan Larkin).
* Added UPS holidays (thank you Tim Anglade).
* Fixed rakefile to force lower case definition file names.
## 0.9.2
* Included rakefile in Gem (thank you James Herdman).
## 0.9.1
* au.yaml was being included incorrectly in US holiday definitions. Thanks to [Glenn Vanderburg](http://vanderburg.org/) for the fix.
## 0.9.0
* Initial release.

74
vendor/holidays/CODE_OF_CONDUCT.md vendored Normal file
View File

@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at holidaysgem@gmail.com. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

3
vendor/holidays/Gemfile vendored Normal file
View File

@ -0,0 +1,3 @@
source 'https://rubygems.org'
gemspec

40
vendor/holidays/Gemfile.lock vendored Normal file
View File

@ -0,0 +1,40 @@
PATH
remote: .
specs:
holidays (8.4.1)
GEM
remote: https://rubygems.org/
specs:
coderay (1.1.3)
docile (1.4.0)
method_source (1.0.0)
mocha (1.12.0)
power_assert (2.0.0)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rake (12.3.3)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3)
test-unit (3.4.2)
power_assert
PLATFORMS
x86_64-linux
DEPENDENCIES
bundler (~> 2)
holidays!
mocha (~> 1)
pry (~> 0.12)
rake (~> 12)
simplecov (~> 0.16)
test-unit (~> 3)
BUNDLED WITH
2.2.18

21
vendor/holidays/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
==== Ruby Holidays Gem License
Copyright (c) 2007, 2014 Alex Dunae
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

45
vendor/holidays/Makefile vendored Normal file
View File

@ -0,0 +1,45 @@
default: test
setup: update-defs
bundle install
generate:
bundle exec rake generate
test:
bundle exec rake test
console:
bundle exec rake console
test-region:
bundle exec rake test_region $(REGION)
build: clean
bundle exec gem build holidays.gemspec
push:
bundle exec gem push $(GEM)
update-defs: definitions/
git submodule update --init --remote --recursive
definitions: point-to-defs-master
point-to-defs-branch:
git submodule add -b $(BRANCH) git@github.com:$(USER)/definitions.git definitions/
point-to-defs-master:
git submodule add https://github.com/holidays/definitions definitions/
clean-defs:
git rm -f definitions
rm -rf .git/modules/definitions
git config -f .git/config --remove-section submodule.definitions 2> /dev/null
clean:
rm -rf holidays-*.gem
rm -rf reports
rm -rf coverage
.PHONY: setup test generate console build push update-defs test-region clean-defs point-to-defs-master point-to-defs-branch clean definitions

322
vendor/holidays/README.md vendored Normal file
View File

@ -0,0 +1,322 @@
# Ruby Holidays Gem [![Build Status](https://travis-ci.org/holidays/holidays.svg?branch=master)](https://travis-ci.org/holidays/holidays)
Functionality to deal with holidays in Ruby.
Extends Ruby's built-in Date and Time classes and supports custom holiday definition lists.
## Installation
```
gem install holidays
```
## Tested versions
This gem is tested with the following ruby versions:
* 2.4.5
* 2.5.3
* 2.6.1
* JRuby 9.2.5.0
## Semver
This gem follows [semantic versioning](http://semver.org/). The guarantee specifically covers:
* methods in the top-most `Holidays` namespace e.g. `Holidays.<method>`
* the [core extensions](#extending-rubys-date-and-time-classes)
Please note that we consider definition changes to be 'minor' bumps, meaning they are backwards compatible with your code but might give different holiday results!
## Time zones
Time zones are ignored. This library assumes that all dates are within the same time zone.
## Usage
This gem offers multiple ways to check for holidays for a variety of scenarios.
#### Checking a specific date
Get all holidays on April 25, 2008 in Australia:
```
Holidays.on(Date.civil(2008, 4, 25), :au)
=> [{:name => 'ANZAC Day',...}]
```
You can check multiple regions in a single call:
```
Holidays.on(Date.civil(2008, 1, 1), :us, :fr)
=> [{:name=>"New Year's Day", :regions=>[:us],...},
{:name=>"Jour de l'an", :regions=>[:fr],...}]
```
You can leave off 'regions' to get holidays for any region in our [definitions](https://github.com/holidays/definitions):
```
Holidays.on(Date.civil(2007, 4, 25))
=> [{:name=>"ANZAC Day", :regions=>[:au],...},
{:name=>"Festa della Liberazione", :regions=>[:it],...},
{:name=>"Dia da Liberdade", :regions=>[:pt],...}
...
]
```
#### Checking a date range
Get all holidays during the month of July 2008 in Canada and the US:
```
from = Date.civil(2008,7,1)
to = Date.civil(2008,7,31)
Holidays.between(from, to, :ca, :us)
=> [{:name => 'Canada Day',...}
{:name => 'Independence Day',...}]
```
#### Check for 'informal' holidays
You can pass the 'informal' flag to include holidays specified as informal in your results. See [here](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md#formalinformal) for information on what constitutes 'informal' vs 'formal'.
By default this flag is turned off, meaning no informal holidays will be returned.
Get Valentine's Day in the US:
```
Holidays.on(Date.new(2018, 2, 14), :us, :informal)
=> [{:name=>"Valentine's Day",...}]
```
Leaving off 'informal' will mean that Valentine's Day is not returned:
```
Holidays.on(Date.new(2018, 2, 14), :us)
=> []
```
Get informal holidays during the month of February 2008 for any region:
```
from = Date.civil(2008,2,1)
to = Date.civil(2008,2,15)
Holidays.between(from, to, :informal)
=> [{:name => 'Valentine\'s Day',...}]
```
#### Check for 'observed' holidays
You can pass the 'observed' flag to include holidays that are observed on different days than they actually occur. See [here](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md#observed) for further explanation of 'observed'.
By default this flag is turned off, meaning no observed logic will be applied.
Get holidays that are observed on Monday July 2, 2007 in British Columbia, Canada:
```
Holidays.on(Date.civil(2007, 7, 2), :ca_bc, :observed)
=> [{:name => 'Canada Day',...}]
```
Leaving off the 'observed' flag will mean that 'Canada Day' is not returned since it actually falls on Sunday July 1:
```
Holidays.on(Date.civil(2007, 7, 2), :ca_bc)
=> []
Holidays.on(Date.civil(2007, 7, 1), :ca_bc)
=> [{:name=>"Canada Day", :regions=>[:ca],...}]
```
Get all observed US Federal holidays between 2018 and 2019:
```
from = Date.civil(2018,1,1)
to = Date.civil(2019,12,31)
Holidays.between(from, to, :federalreserve, :observed)
=> [{:name => "New Year's Day"....}
{:name => "Birthday of Martin Luther King, Jr"....}]
```
#### Check whether any holidays occur during work week
Check if there are any holidays taking place during a specified work week. 'Work week' is defined as the period of Monday through Friday of the week specified by the date.
Check whether a holiday falls during first week of the year for any region:
```
Holidays.any_holidays_during_work_week?(Date.civil(2016, 1, 1))
=> true
```
You can also pass in `informal` or `observed`:
```
# Returns true since Valentine's Day falls on a Wednesday
holidays.any_holidays_during_work_week?(date.civil(2018, 2, 14), :us, :informal)
=> true
# Returns false if you don't specify informal
irb(main):006:0> Holidays.any_holidays_during_work_week?(Date.civil(2018, 2, 14), :us)
=> false
# Returns true since Veteran's Day is observed on Monday November 12, 2018
holidays.any_holidays_during_work_week?(date.civil(2018, 11, 12), :us, :observed)
=> true
# Returns false if you don't specify observed since the actual holiday is on Sunday November 11th 2018
irb(main):005:0> Holidays.any_holidays_during_work_week?(Date.civil(2018, 11, 12), :us)
=> false
```
#### Find the next holiday(s) that will occur from a specific date
Get the next holidays occurring from February 23, 2016 for the US:
```
Holidays.next_holidays(3, [:us, :informal], Date.civil(2016, 2, 23))
=> [{:name => "St. Patrick's Day",...}, {:name => "Good Friday",...}, {:name => "Easter Sunday",...}]
```
You can specify the number of holidays to return. This method will default to `Date.today` if no date is provided.
#### Find all holidays occuring starting from a specific date to the end of the year
Get all holidays starting from February 23, 2016 to end of year in the US:
```
Holidays.year_holidays([:ca_on], Date.civil(2016, 2, 23))
=> [{:name=>"Good Friday",...},
{name=>"Easter Sunday",...},
{:name=>"Victoria Day",...},
{:name=>"Canada Day",...},
{:name=>"Civic Holiday",...},
{:name=>"Labour Day",...},
{:name=>"Thanksgiving",...},
{:name=>"Remembrance Day",...},
{:name=>"Christmas Day",...},
{:name=>"Boxing Day",...}]
```
This method will default to `Date.today` if no date is provided.
#### Return all available regions
Return all available regions:
```
Holidays.available_regions
=> [:ar, :at, ..., :sg] # this will be a big array
```
## Loading Custom Definitions on the fly
In addition to the [provided definitions](https://github.com/holidays/definitions) you can load custom definitions file on the fly and use them immediately.
To load custom 'Company Founding' holiday on June 1st:
```
Holidays.load_custom('/home/user/holiday_definitions/custom_holidays.yaml')
Holidays.on(Date.civil(2013, 6, 1), :my_custom_region)
=> [{:name => 'Company Founding',...}]
```
Custom definition files must match the [syntax of the existing definition files](https://github.com/holidays/definitions/blob/master/doc/SYNTAX.md).
Multiple files can be loaded at the same time:
```
Holidays.load_custom('/home/user/holidays/custom_holidays1.yaml', '/home/user/holidays/custom_holidays2.yaml')
```
## Extending Ruby's Date and Time classes
### Date
To extend the 'Date' class:
```
require 'holidays/core_extensions/date'
class Date
include Holidays::CoreExtensions::Date
end
```
Now you can check which holidays occur in Iceland on January 1, 2008:
```
d = Date.civil(2008,7,1)
d.holidays(:is)
=> [{:name => 'Nýársdagur'}...]
```
Or lookup Canada Day in different regions:
```
d = Date.civil(2008,7,1)
d.holiday?(:ca) # Canada
=> true
d.holiday?(:ca_bc) # British Columbia, Canada
=> true
d.holiday?(:fr) # France
=> false
```
Or return the new date based on the options:
```
d = Date.civil(2008,7,1)
d.change(:year => 2016, :month => 1, :day => 1)
=> #<Date: 2016-01-01 ((2457389j,0s,0n),+0s,2299161j)>
```
Or you can calculate the day of the month:
```
Date.calculate_mday(2015, 4, :first, 2)
=> 7
```
### Time
```
require 'holidays/core_extensions/time'
class Time
include Holidays::CoreExtensions::Time
end
```
Find end of month for given date:
```
d = Date.civil(2016,8,1)
d.end_of_month
=> #<Date: 2016-08-31 ((2457632j,0s,0n),+0s,2299161j)>
```
## Caching Holiday Lookups
If you are checking holidays regularly you can cache your results for improved performance. Run this before looking up a holiday (e.g. in an initializer):
```
YEAR = 365 * 24 * 60 * 60
Holidays.cache_between(Time.now, Time.now + 2 * YEAR, :ca, :us, :observed)
```
Holidays for the regions specified within the dates specified will be pre-calculated and stored in-memory. Future lookups will be much faster.
## How to contribute
See our [contribution guidelines](doc/CONTRIBUTING.md) for information on how to help out!
## Credits and code
* Started by [@alexdunae](http://github.com/alexdunae) 2007-2012
* Maintained by [@hahahana](https://github.com/hahahana), 2013
* Maintained by [@ppeble](https://github.com/ppeble), 2014-present
* Maintained by [@ttwo32](https://github.com/ttwo32), 2016-present
Plus all of these [wonderful contributors!](https://github.com/holidays/holidays/contributors)

109
vendor/holidays/Rakefile vendored Normal file
View File

@ -0,0 +1,109 @@
$:.unshift File.expand_path('../lib', __FILE__)
$:.unshift File.expand_path('../test', __FILE__)
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'yaml'
require 'fileutils'
require 'holidays'
DEFINITION_PATH = 'definitions'
DEFINITION_TESTS_PATH = 'test/defs'
Rake::TestTask.new(:test) do |t|
t.libs << 'test'
t.test_files = FileList['test/**/test_*.rb']
end
task :default => :test
desc "Run tests for only a single region. Do not provide sub regions. Example (without quotes): 'rake test_region jp'"
task :test_region do
# Magic to define empty tasks on the fly so we have nicer arguments, see http://cobwwweb.com/4-ways-to-pass-arguments-to-a-rake-task
ARGV.each { |a| task a.to_sym do ; end }
if ARGV[1].nil? || ARGV[1].empty?
raise ArgumentError.new("You must provide a region. Example (without quotes): 'rake test_region us'")
end
region = ARGV[1].downcase
unless Holidays.available_regions.include?(region.to_sym)
raise ArgumentError.new("Region '#{region}' not recognized")
end
unless File.file?("#{DEFINITION_TESTS_PATH}/test_defs_#{region}.rb")
raise ArgumentError.new("Test file not found for region '#{region}'. Do not use sub regions, try the overall region instead. Example: 'us' instead of 'us_dc'")
end
sh "bundle exec ruby #{DEFINITION_TESTS_PATH}/test_defs_#{region}.rb"
end
desc 'Launch IRB session'
task :console do
sh "irb -r rubygems -I lib -r holidays.rb"
end
desc 'Generate definitions and tests used in main holiday logic based on raw YAML definitions'
namespace :generate do
desc 'Generate the holiday definition files'
task :definitions do
# load the index
def_index = YAML.load_file("#{DEFINITION_PATH}/index.yaml")
# create a dir for the generated tests
FileUtils.mkdir_p(DEFINITION_TESTS_PATH)
#TODO This entire section should be moved into '/lib/holidays/definition'. I don't think such an
# important part of the gem should be left in the Rakefile and without unit tests. There's no
# reason we can't move it.
all_regions = {}
def_index['defs'].each do |region, files|
puts "Building #{region} definition module:"
files = files.collect { |f| "#{DEFINITION_PATH}/#{f}" }.uniq
regions, rules_by_month, custom_methods, tests = Holidays::Factory::Definition.file_parser.parse_definition_files(files)
module_src, test_src = Holidays::Factory::Definition.source_generator.generate_definition_source(region, files, regions, rules_by_month, custom_methods, tests)
File.open("lib/#{Holidays::DEFINITIONS_PATH}/#{region.downcase.to_s}.rb","w") do |file|
file.puts module_src
end
unless test_src.empty?
File.open("#{DEFINITION_TESTS_PATH}/test_defs_#{region.downcase.to_s}.rb","w") do |file|
file.puts test_src
end
end
all_regions[region.downcase.to_sym] = regions
puts "Done.\n\n"
end
puts "Building regions master file for later validation:"
File.open("lib/#{Holidays::DEFINITIONS_PATH}/REGIONS.rb","w") do |file|
file.puts Holidays::Factory::Definition.regions_generator.call(all_regions)
end
puts "Done.\n\n"
end
desc 'Build the definition manifest'
task :manifest do
File.open("lib/#{Holidays::DEFINITIONS_PATH}/MANIFEST","w") do |file|
#TODO Generating the file source should be done interally, in the /lib dir, not in the Rakefile
file.puts <<-EOH
==== Regional definitions
The following definition files are included in this installation:
EOH
FileList.new("lib/#{Holidays::DEFINITIONS_PATH}/*.rb").exclude(/version/).each do |str|
file.puts('* ' + str.gsub(/^lib\/|\.rb$/, ''))
end
end
puts "Updated manifest file."
end
end
task :generate => ['generate:definitions', 'generate:manifest']

7
vendor/holidays/bin/console vendored Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env ruby
require "bundler/setup"
require "holidays"
require "irb"
IRB.start

6
vendor/holidays/bin/setup vendored Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
set -vx
bundle install

272
vendor/holidays/definitions/CHANGELOG.md vendored Normal file
View File

@ -0,0 +1,272 @@
# Holiday definitions
## 5.3.1
Fix jp holidays from 2022.
* :+1: Reflects changes in Japanese holidays in 2021.(Thanks to https://github.com/ryosukeYamazaki)
## 5.3.0
Update many defitnions.
Definitions changes:
* Change name of Foundation Day in Western Australia to 'Western Austra…(Thanks to https://github.com/mattman)
* add Kazakh holidays(Thanks to https://github.com/Legomegger)
* Add AFL Grand final dates for 2018-2020(Thanks to https://github.com/anicholson)
* Add 2021 jp holiday(Thanks to https://github.com/ryosukeYamazaki)
## 5.2.0
Update many defitnions.
Definitions changes:
* Update hr.yaml(Thanks to https://github.com/KarloPletesImago)
* Terry Fox Day not a formal holiday(Thanks to https://github.com/tabbasi88)
* Added the Zibelemärit to the region ch_be(Thanks to https://github.com/hrigu)
* add "Lunes de Pascua Granada" to Catalunya holidays(Thanks to https://github.com/thefabbulus)
* Correcting observed Battle of the Boyne, N.Ireland (Problem occurs July 2020)(Thanks to https://github.com/qidane)
* Modify terry fox date test.
* Fix ch holidays.
## 5.1.0
Update many defitnions.
Definitions changes:
* Add Nigerian Holidays(Thanks to https://github.com/osioke)
* Add 2024 calendar year to Federal Reserve banks(Thanks to https://github.com/JeremiahChurch)
* Nunavut July 9th new statutory holiday from 2020(Thanks to https://github.com/tabbasi88)
* Add Ramadan & Sacrafice holidays in 2020(Thanks to https://github.com/saygun)
* Mark mexicans dates as informal(Thanks to https://github.com/arandilopez)
* Add May 1 and May 9 holidays for Luxembourg(Thanks to https://github.com/pmor)
* New Croatian holidays 2020(Thanks to https://github.com/KarloPletesImago)
* DE: adde new liberation day for Berlin 2020 only(Thanks to https://github.com/estani)
* Add Québec to provinces observing Canadian Thanksgiving(Thanks to https://github.com/rafbm)
## 5.0.1
No behavior change.
Commenting out a failing `it` test due to limitations of the current definition format. Unfortunately a holiday was added to the `it` region that falls on the same day as another existing region and we do not alwayd handle that in a uniform, consistent way. Currently there is no way to test that the _second_ region that is returned on a day is valid. Because of this I'm commenting out the test and moving forward. We'll need to add this functionality later.
I only caught this when releasing the ruby gem. This goes back once again to [this issue](https://github.com/holidays/definitions/issues/42) with how we can test against an actual implementation from this repository.
## 5.0.0
Major semver bump due to changes related to the `year_ranges` option. The following keys have been renamed:
* `before` is now `until`
* `after` is now `from`
The behavior of these two options has not changed. To read more about the reasons behind this change please see the [associated ADR](doc/architecture/adr-002.md).
Definitions changes:
* Fix typos and syntax on `th` defs
* Update Christmas-related holidays in `us` and `ca` (thanks to https://github.com/jonjonw)
* Add `it_rm` as `it` subregion (thanks to https://github.com/stephane)
* Update `it` subregions for accuracy (thanks to https://github.com/nolith and https://github.com/NatyDev)
* Add `ro` region (thanks to https://github.com/stephane)
* Update `il` and `ca` holidays for accuracy (thanks to https://github.com/ghiculescu)
* Add `lv` region (thanks to https://github.com/aleksandrs-ledovskis)
* Update `es` holidays (thanks to https://github.com/thefabbulus)
* Update `gb` region to fix May Day (thanks to https://github.com/LauraBondini)
* Update `hu` region for Easter accuracy (thanks to https://github.com/HuBandiT)
## 4.1.0
* Add new Emperor's Coronation Day holiday to `jp` (thanks to https://github.com/ttwo32)
* Add Thai Holidays (whoooo) (thanks to https://github.com/fabersky)
* Add Berlin's New International Women's Day to `de_be` (thanks to https://github.com/iGEL)
* Add Civic Holiday (Terry Fox Day) to `ca_mb` (thanks to https://github.com/akaspick)
* Fix Federal Reserve holidays for Independence Day (thanks to https://github.com/chadrschroeder)
## 4.0.0
Major semver bump due to changes in how non-standard regions will be handled going forward. Please see [issue-110](https://github.com/holidays/definitions/issues/110) for more details on this edge case and please also see the updates to our [SYNTAX guide](doc/SYNTAX.md#non-standard-regions) for the specified behavior going forward.
The following non-standard regions have been changed:
* `ecb_target` region changed to `ecbtarget`
* `federal_reserve` region changed to `federalreserve`
* `federal_reserve_banks` region changed to `federalreservebanks`
* `north_america_informal` region changed to `northamericainformal`
* `united_nations` region changed to `unitednations`
* `north_america` region changed to `northamerica`
* `south_america` region changed to `southamerica`
This change also includes updates to various other regions:
* Rename national sports day of `:jp` region from "体育の日" to "スポーツの日" (thanks to https://github.com/kunitoo)
* Fix 2020 `:jp` region holidays related tokyo olympics (thanks to https://github.com/kunitoo)
* Update Family Day date in `:ca_bc` region (thanks to https://github.com/roman-ih)
* Add Ukrainian holidays (`:ua` region code) (thanks to https://github.com/roman-ih)
* Add `federalreservebanks` region for observed bank holidays (thanks to Matt Hickman)
## 3.1.0
* Update `ch` to apply 'Neujahrstag' to overall region (thanks to https://github.com/phylor)
* Cosmetic spacing update for `us` definition, no behavior change
## 3.0.0
Major semver bump as the format for custom methods has been changed to complete [issue-24](https://github.com/holidays/definitions/issues/24). Downstream consumers will need to update to be able to parse them. However there are **no behavior changes** with this update.
In summary: we have switched to language-specific custom methods. Instead of a plain `source` field you will need a specific language implementation, e.g. `ruby`, `golang`, etc.
Currently we only have `ruby` but we can now expand these definitions for use in other languages. Please see the [custom methods ADR](doc/architecture/adr-001.md) for more in-depth information on why this change was made.
You can also view the updated ['Methods' section in the SYNTAX doc](doc/SYNTAX.md#methods) for more info and examples.
## 2.5.3
* Add missing `observed` logic for 'St. Patricks Day' in `gb_nir`
## 2.5.2
* Fix `de` issue cause by undefined `year_ranges` behavior in syntax
## 2.5.1
* Fix Federal Reserve Independence Day tests
## 2.5.0
* Change Emperor's Birthday for `jp` definitions (thanks to https://github.com/ttwo32)
* Add German Reformation to four more states starting in 2018 (thanks to https://github.com/jensberke)
* Add 'La Mercè' to official holidays in Catalunya, Spain (thanks to https://github.com/fabersky)
* Fix Federal Reserve Saturday holidays (thanks to https://github.com/mikecanann)
* Fix the CoC link in CONTRIBUTING doc
* Remove ruby 2.2 and add ruby 2.5 to travis tests
## 2.4.0
* Add new holidays for Canada (thanks to https://github.com/alejandrok5)
## 2.3.0
* Fix typo in `:at` definitions (thanks to https://github.com/AlexMarold)
* Add holidays for Jersey and Guernsey (thanks to https://github.com/timkrins)
* Update Travis config to fix build issues related to imminent release of ruby 2.5
## 2.2.1
* Small updates to tests in the `:de` regions. No behavior changes.
## 2.2.0
* Audit provincial holidays in Canada (thanks to https://github.com/slucaskim)
* Add civic holiday for `ca_pe` (thanks to https://github.com/slucaskim)
* Correct reformation day for `de` (thanks to https://github.com/spaceneedle2019)
## 2.1.1
* Comment out test for `추석` until a discussion can be had in [issue 69](https://github.com/holidays/definitions/issues/69) (nice)
## 2.1.0
Update the following regions:
* `ca_ab` - change 'Heritage Day' to informal
* `kr` - Update '추석 연휴' and `설날 연휴` for accuracy
* `cl` - Add 'San Pedro y San Pablo', update 'Encuentro de Dos Mundos', and add 'Día de las Iglesias Evangélicas y Protestantes'
## 2.0.0
* Update `tr`, `fedex` for accuracy
* Completely change the test format to no longer use ruby source code! Hooray! This should cause no behavior differences,
any differences or changes in behavior should be considered a regression.
## 1.7.1
A small bugfix that resolves the naming issues of two regions in the 'index.yaml' file. No other outward changes.
## 1.7.0
Here are the changes:
* Add Estonian definitions
* Enhance France definitions
* Correct and enhance German definitions
* Enhance Portuguese definitions
* Add Malta definitions
* Add Serbian definitions
* Add Georgian definitions
* Use Orthodox easter calculations in appropriate regions
* Add Russian definitions
* Add Turkey definitions
* Enhance US definitions (lots of individual US states!)
* Update South Australian definitions
## 1.6.1
* Update `ca` test for correctness. See below for more information.
Unfortunately due to our current setup it is possible for definitions/tests in this repository to appear 'valid' but only
fail when we run them in the actual ruby holidays repo. This is a known issue (#42) and needs to be addressed.
In the meantime, this is a bugfix release to ensure we can release v5.6.0 of the ruby repo.
## 1.6.0
Updates to the following Canadian regions: `ca_ab, ca_bc, ca_mb, ca_nt, ca_nu, ca_on, ca_sk, ca_yt, ca_pe`
## 1.5.1
* Fix error in `fedex` custom method `day_after_thanksgiving`
## 1.5.0
* Update NYSE to fix observed NYD
* Use native language for KR
* Use native language for VI
* Update AU definitions for accuracy
* Update KR definitions to include lunar holiday calculations
* Add VI definitions
## 1.4.0
* :au - corrects holidays for certain regions
* :vi - reports holiday names in Vietnamese instead of English, adds 1 additional holiday (Giỗ tổ Hùng Vương)
## 1.3.0
* Add Travis badge to README
* Add Tunisian holidays
* Correct various Australian holidays
* Updates various German regions to be more accurate
* Changed 'nf' to 'nl' for Newfoundland & Labrador
* Changed 'yk' to 'yt'kkk
## 1.2.1
* Fix syntax and test errors in au and ca def tests
## 1.2.0
* updates jp defs to fix 'Foundation Day' name
* Fix ca defs for observed holidays
* Update au defs to have Christmas and Boxing Day for all of Australia instead of just individual territories
* Update ie defs to consolidate "St Stephen's Day" to use common method instead of custom method
## 1.1.0
* Add HK definitions
* Add KR definitions
* Fix small bug in JP definitions
## 2016 1.0.0
Initial creation of this repository
This contains all of the definitions currently in the holidays repository but split out into its own repository. It will
be added as a submodule of the ruby repository, which will be responsible for generating its final classes.
The idea is that we will have repositories for multiple languages and each language is responsible for using the definitions
as it sees fit.

6
vendor/holidays/definitions/Gemfile vendored Normal file
View File

@ -0,0 +1,6 @@
source 'https://rubygems.org'
gem 'rspec', '~> 3'
gem 'pry', :require => false
gem 'spoon', :require => false
gem 'simplecov-rcov', :require => false

21
vendor/holidays/definitions/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
==== Ruby Holidays Gem License
Copyright (c) 2016 Phil Peble
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

26
vendor/holidays/definitions/METHODS.yml vendored Normal file
View File

@ -0,0 +1,26 @@
---
methods:
easter:
arguments: year
orthodox_easter:
arguments: year
orthodox_easter_julian:
arguments: year
to_monday_if_sunday:
arguments: date
to_monday_if_weekend:
arguments: date
to_weekday_if_boxing_weekend:
arguments: date
to_weekday_if_boxing_weekend_from_year:
arguments: year
to_weekday_if_weekend:
arguments: date
calculate_day_of_month:
arguments: year, month, day, wday
to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday:
arguments: year
to_tuesday_if_sunday_or_monday_if_saturday:
arguments: date
lunar_to_solar:
arguments: year, month, day, region

9
vendor/holidays/definitions/Makefile vendored Normal file
View File

@ -0,0 +1,9 @@
default: validate
validate:
bundle exec ruby lib/validation/run.rb
test:
bundle exec rspec
.PHONY: validate,test

22
vendor/holidays/definitions/README.md vendored Normal file
View File

@ -0,0 +1,22 @@
# Holidays Definitions [![Build Status](https://travis-ci.org/holidays/definitions.svg?branch=master)](https://travis-ci.org/holidays/definitions)
This repository contains the 'raw' definitions for the various holidays projects. It should be added a submodule to
any project that wants to use them.
Currently it is only used by the [existing Holidays gem](https://github.com/holidays/holidays), which takes these
definitions and generates ruby classes for use in that gem. In the future it will be used by other languages in
a similar manner.
**Please note** that this is _not_ a gem. The validation process is written in ruby simply for convenience. The real
stars of this show are the YAML files.
### Documentation
1. [Syntax Guide](doc/SYNTAX.md)
2. [Contribution Guidelines](doc/CONTRIBUTING.md)
3. [Maintainer Guidelines](doc/MAINTAINERS.md)
4. [Architecture Decision Records](doc/architecture/README.md)
### Credits
Thank you to all of these [wonderful contributors!](https://github.com/holidays/definitions/contributors)

202
vendor/holidays/definitions/ar.yaml vendored Normal file
View File

@ -0,0 +1,202 @@
# Argentinian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2016-02-26.
#
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Argentina
# - http://servicios.lanacion.com.ar/feriados/2016
---
months:
0:
- name: Viernes Santo
regions: [ar]
function: easter(year)
function_modifier: -2
- name: Carnaval Lunes
regions: [ar]
function: easter(year)
function_modifier: -48
- name: Carnaval Martes
regions: [ar]
function: easter(year)
function_modifier: -47
1:
- name: Año Nuevo
regions: [ar]
mday: 1
3:
- name: Día Nacional de la Memoria por la Verdad y la Justicia
regions: [ar]
mday: 24
4:
- name: Día del Veterano y de los Caídos en la Guerra de Malvinas
regions: [ar]
mday: 2
5:
- name: Día del Trabajador
regions: [ar]
mday: 1
- name: Día de la Revolución de Mayo
regions: [ar]
mday: 25
6:
- name: Día de la Bandera
regions: [ar]
mday: 20
7:
- name: Feriado puente turístico
regions: [ar]
mday: 8
- name: Día de la Independencia
regions: [ar]
mday: 9
8:
- name: Paso a la Inmortalidad del General José de San Martín
regions: [ar]
mday: 15
10:
- name: Día del Respeto a la Diversidad Cultural
regions: [ar]
mday: 12
11:
- name: Día de la Soberanía Nacional
regions: [ar]
mday: 20
12:
- name: Inmaculada Concepción de María
regions: [ar]
mday: 8
- name: Feriado puente turístico
regions: [ar]
mday: 9
- name: Navidad
regions: [ar]
mday: 25
tests:
- given:
date: '2016-01-01'
regions: ['ar']
options: 'informal'
expect:
name: 'Año Nuevo'
- given:
date: '2016-02-08'
regions: ['ar']
options: 'informal'
expect:
name: 'Carnaval Lunes'
- given:
date: '2016-02-09'
regions: ['ar']
options: 'informal'
expect:
name: 'Carnaval Martes'
- given:
date: '2017-02-27'
regions: ['ar']
options: 'informal'
expect:
name: 'Carnaval Lunes'
- given:
date: '2017-02-28'
regions: ['ar']
options: 'informal'
expect:
name: 'Carnaval Martes'
- given:
date: '2018-02-12'
regions: ['ar']
options: 'informal'
expect:
name: 'Carnaval Lunes'
- given:
date: '2018-02-13'
regions: ['ar']
options: 'informal'
expect:
name: 'Carnaval Martes'
- given:
date: '2016-03-24'
regions: ['ar']
options: 'informal'
expect:
name: 'Día Nacional de la Memoria por la Verdad y la Justicia'
- given:
date: '2016-03-25'
regions: ['ar']
options: 'informal'
expect:
name: 'Viernes Santo'
- given:
date: '2016-04-02'
regions: ['ar']
options: 'informal'
expect:
name: 'Día del Veterano y de los Caídos en la Guerra de Malvinas'
- given:
date: '2016-05-01'
regions: ['ar']
options: 'informal'
expect:
name: 'Día del Trabajador'
- given:
date: '2016-05-25'
regions: ['ar']
options: 'informal'
expect:
name: 'Día de la Revolución de Mayo'
- given:
date: '2016-06-20'
regions: ['ar']
options: 'informal'
expect:
name: 'Día de la Bandera'
- given:
date: '2016-07-08'
regions: ['ar']
options: 'informal'
expect:
name: 'Feriado puente turístico'
- given:
date: '2016-07-09'
regions: ['ar']
options: 'informal'
expect:
name: 'Día de la Independencia'
- given:
date: '2016-08-15'
regions: ['ar']
options: 'informal'
expect:
name: 'Paso a la Inmortalidad del General José de San Martín'
- given:
date: '2016-10-12'
regions: ['ar']
options: 'informal'
expect:
name: 'Día del Respeto a la Diversidad Cultural'
- given:
date: '2016-11-20'
regions: ['ar']
options: 'informal'
expect:
name: 'Día de la Soberanía Nacional'
- given:
date: '2016-12-08'
regions: ['ar']
options: 'informal'
expect:
name: 'Inmaculada Concepción de María'
- given:
date: '2016-12-09'
regions: ['ar']
options: 'informal'
expect:
name: 'Feriado puente turístico'
- given:
date: '2016-12-25'
regions: ['ar']
options: 'informal'
expect:
name: 'Navidad'

116
vendor/holidays/definitions/at.yaml vendored Normal file
View File

@ -0,0 +1,116 @@
# Austrian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2011-08-31 by VGSG
# Sources:
# - http://de.wikipedia.org/wiki/Feiertage_in_%C3%96sterreich
# - http://www.timeanddate.com/calendar/index.html?country=8
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
---
months:
0:
- name: Ostermontag
regions: [at]
function: easter(year)
function_modifier: 1
- name: Christi Himmelfahrt
regions: [at]
function: easter(year)
function_modifier: 39
- name: Pfingstmontag
regions: [at]
function: easter(year)
function_modifier: 50
- name: Fronleichnam
regions: [at]
function: easter(year)
function_modifier: 60
1:
- name: Neujahrstag
regions: [at]
mday: 1
- name: Heilige Drei Könige
regions: [at]
mday: 6
5:
- name: Staatsfeiertag
regions: [at]
mday: 1
8:
- name: Mariä Himmelfahrt
regions: [at]
mday: 15
10:
- name: Nationalfeiertag
regions: [at]
mday: 26
11:
- name: Allerheiligen
regions: [at]
mday: 1
12:
- name: Mariä Empfängnis
regions: [at]
mday: 8
- name: 1. Weihnachtstag
regions: [at]
mday: 25
- name: 2. Weihnachtstag
regions: [at]
mday: 26
tests:
- given:
date: '2009-01-01'
regions: ['at']
options: 'informal'
expect:
name: 'Neujahrstag'
- given:
date: '2009-04-13'
regions: ['at']
expect:
name: 'Ostermontag'
- given:
date: '2009-05-21'
regions: ['at']
expect:
name: 'Christi Himmelfahrt'
- given:
date: '2009-06-01'
regions: ['at']
expect:
name: 'Pfingstmontag'
- given:
date: '2009-10-26'
regions: ['at']
options: 'informal'
expect:
name: 'Nationalfeiertag'
- given:
date: '2009-12-08'
regions: ['at']
options: 'informal'
expect:
name: 'Mariä Empfängnis'
- given:
date: '2009-12-25'
regions: ['at']
options: 'informal'
expect:
name: '1. Weihnachtstag'
- given:
date: '2009-12-26'
regions: ['at']
options: 'informal'
expect:
name: '2. Weihnachtstag'
- given:
date: '2010-05-08'
regions: ['at']
expect:
holiday: false
- given:
date: '2017-06-15'
regions: ['at']
expect:
name: "Fronleichnam"

751
vendor/holidays/definitions/au.yaml vendored Normal file
View File

@ -0,0 +1,751 @@
# Australian holiday definitions for the Ruby Holiday gem.
# Updated: 2020-07-15
# Sources:
# - http://en.wikipedia.org/wiki/Australian_public_holidays
# - http://www.docep.wa.gov.au/lr/LabourRelations/Content/Wages%20and%20Conditions/Public%20Holidays/Public_Holidays.html
# - http://www.wst.tas.gov.au/employment_info/public_holidays
# - https://www.fairwork.gov.au/leave/public-holidays/list-of-public-holidays
---
months:
0:
- name: Good Friday
regions: [au]
function: easter(year)
function_modifier: -2
- name: Easter Saturday
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa]
function: easter(year)
function_modifier: -1
- name: Easter Sunday
regions: [au_nsw, au_vic]
function: easter(year)
- name: Easter Sunday
regions: [au_qld, au_act]
function: easter(year)
year_ranges:
from: 2017
- name: Easter Monday
regions: [au]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [au, au_nsw, au_vic, au_act, au_sa, au_wa, au_nt, au_qld]
mday: 1
observed: to_monday_if_weekend(date)
- name: New Year's Day
regions: [au_tas]
mday: 1
function: to_monday_if_weekend(date)
- name: Australia Day
regions: [au]
mday: 26
observed: to_monday_if_weekend(date)
2:
- name: Royal Hobart Regatta
regions: [au_tas_south]
week: 2
wday: 1
3:
- name: Labour Day
regions: [au_wa]
week: 1
wday: 1
- name: Eight Hours Day
regions: [au_tas]
week: 2
wday: 1
- name: Labour Day
regions: [au_vic]
week: 2
wday: 1
- name: March Public Holiday
regions: [au_sa]
function: march_pub_hol_sa(year)
- name: Canberra Day
regions: [au_act]
week: 2
wday: 1
4:
- name: ANZAC Day
regions: [au]
mday: 25
- name: ANZAC Day
regions: [au_nsw, au_vic, au_qld, au_nt, au_act, au_sa, au_tas]
mday: 25
observed: to_monday_if_sunday(date)
- name: ANZAC Day
regions: [au_wa]
mday: 25
observed: to_monday_if_weekend(date)
5:
- name: Labour Day
regions: [au_qld]
function: qld_labour_day_may(year)
- name: May Day
regions: [au_nt]
week: 1
wday: 1
- name: May Public Holiday
regions: [au_sa]
function: may_pub_hol_sa(year)
6:
- name: Western Australia Day
regions: [au_wa]
week: 1
wday: 1
- name: Queen's Birthday
regions: [au_act, au_nsw, au_sa, au_tas, au_nt, au_vic]
week: 2
wday: 1
- name: Queen's Birthday
regions: [au_qld]
function: qld_queens_birthday_june(year)
- name: Queensland Day
regions: [au_qld]
mday: 6
type: informal
7:
- name: Cairns Show
regions: [au_qld_cairns]
week: 3
wday: 5
8:
- name: Ekka
regions: [au_qld_brisbane]
week: -3
wday: 3
9:
- name: Queen's Birthday
regions: [au_wa]
week: -1
wday: 1
- name: "Family & Community Day"
regions: [au_act]
week: -1
wday: 1
10:
- name: Friday before the AFL Grand Final
regions: [au_vic]
function: afl_grand_final(year)
- name: Labour Day
regions: [au_act, au_nsw, au_sa]
week: 1
wday: 1
- name: Labour Day
regions: [au_qld]
function: qld_labour_day_october(year)
observed: to_monday_if_weekend(date)
- name: Queen's Birthday
regions: [au_qld]
function: qld_queens_bday_october(year)
observed: to_monday_if_weekend(date)
- name: Royal Hobart Show
regions: [au_tas_south]
function: hobart_show_day(year)
11:
- name: G20 Day
regions: [au_qld_brisbane]
function: g20_day_2014_only(year)
- name: Recreation Day # http://www.timeanddate.com/holidays/australia/recreation-day
regions: [au_tas_north]
wday: 1
week: 1
- name: Melbourne Cup Day
regions: [au_vic_melbourne]
week: 1
wday: 2
12:
- name: Christmas Day # CHRISTMAS DAY - All states except SA observe on 27th (and 25th) if 25th is a Sunday
regions: [au_qld, au_nsw, au_act, au_tas, au_wa, au_vic, au_nt]
mday: 25
observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
- name: Boxing Day
regions: [au_nsw, au_vic, au_qld, au_act, au_wa]
mday: 26
observed: to_tuesday_if_sunday_or_monday_if_saturday(date)
- name: Boxing Day
regions: [au_tas, au_nt]
function: to_weekday_if_boxing_weekend_from_year(year)
- name: Proclamation Day
regions: [au_sa]
function: to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)
- name: Christmas Day # CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
regions: [au_sa]
mday: 25
observed: to_monday_if_weekend(date)
methods:
afl_grand_final:
arguments: year
ruby: |
case year
when 2015
Date.civil(2015, 10, 2)
when 2016
Date.civil(2016, 9, 30)
when 2017
Date.civil(2017, 9, 29)
when 2018
Date.civil(2018, 9, 28)
when 2019
Date.civil(2019,9, 27)
when 2020
Date.civil(2020, 10, 23)
end
qld_queens_bday_october:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# celebrated twice in 2012
# in october again from 2016
arguments: year
ruby: |
if year >= 2016
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
elsif year == 2012
1
else
nil
end
qld_queens_birthday_june:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# in june until 2015
arguments: year
ruby: |
if year <= 2015
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 6, 2, 1)
end
qld_labour_day_may:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# for 2013 to 2016 it was in October, otherwise it's in May
arguments: year
ruby: |
if year < 2013 || year >= 2016
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, 1, 1)
end
qld_labour_day_october:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# for 2013 to 2016 it was in October, otherwise it's in May
arguments: year
ruby: |
if year >= 2013 && year < 2016
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 1, 1)
end
g20_day_2014_only:
# http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
# G20 day in brisbane, in 2014, on november 14
arguments: year
ruby: |
year == 2014 ? 14 : nil
hobart_show_day:
# http://worksafe.tas.gov.au/__data/assets/pdf_file/0008/287036/Public_Holidays_2014.pdf
# The Thursday before the fourth Saturday in October.
arguments: year
ruby: |
fourth_sat_in_oct = Date.civil(year, 10, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 4, :saturday))
fourth_sat_in_oct - 2 # the thursday before
march_pub_hol_sa:
# http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
# The Holidays Act 1910 provides for the third Monday in May to be a public holiday. Since 2006 this public holiday has been observed on the second Monday in March through the issuing of a special Proclamation by the Governor.
arguments: year
ruby: |
if year < 2006
nil
else
Date.civil(year, 3, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 3, :second, :monday))
end
may_pub_hol_sa:
# http://www.safework.sa.gov.au/show_page.jsp?id=2483#.VQ9Mfmb8-8E
# The Holidays Act 1910 provides for the third Monday in May to be a public holiday. Since 2006 this public holiday has been observed on the second Monday in March through the issuing of a special Proclamation by the Governor.
arguments: year
ruby: |
if year >= 2006
nil
else
Date.civil(year, 5, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 5, :third, :monday))
end
tests:
- given:
date: "2017-04-14"
regions: ["au"]
expect:
name: "Good Friday"
- given:
date: "2017-04-15"
regions: ["au_nsw"]
expect:
name: "Easter Saturday"
- given:
date: ['2010-4-4', "2017-04-16"]
regions: ["au_nsw"]
expect:
name: "Easter Sunday"
- given:
date: '2013-10-07'
regions: ["au_qld"]
expect:
name: 'Labour Day'
- given:
date: '2012-05-07'
regions: ["au_qld"]
expect:
name: 'Labour Day'
- given:
date: '2015-10-05'
regions: ["au_qld"]
expect:
name: 'Labour Day'
- given:
date: '2016-05-02'
regions: ["au_qld"]
expect:
name: 'Labour Day'
- given:
date: ['2012-06-11', '2012-10-01', '2013-6-10', '2015-6-8', '2016-10-3']
regions: ["au_qld"]
expect:
name: "Queen's Birthday"
- given:
date: ['2014-09-29', '2015-09-28', '2016-09-26']
regions: ["au_wa"]
expect:
name: "Queen's Birthday"
- given:
date: '2014-09-29'
regions: ["au_act"]
expect:
name: 'Family & Community Day'
- given:
date: '2015-09-28'
regions: ["au_act"]
expect:
name: 'Family & Community Day'
- given:
date: '2016-09-26'
regions: ["au_act"]
expect:
name: 'Family & Community Day'
- given:
date: '2014-01-26'
regions: ["au_qld"]
expect:
name: 'Australia Day'
- given:
date: '2014-01-27'
regions: ["au_qld"]
options: ["observed"]
expect:
name: 'Australia Day'
- given:
date: '2014-07-18'
regions: ["au_qld_cairns"]
expect:
name: 'Cairns Show'
- given:
date: '2013-07-19'
regions: ["au_qld_cairns"]
expect:
name: 'Cairns Show'
- given:
date: '2013-10-24'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Show'
- given:
date: '2014-10-23'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Show'
- given:
date: '2015-10-22'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Show'
- given:
date: '2016-10-20'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Show'
- given:
date: '2013-11-04'
regions: ["au_tas_north"]
expect:
name: 'Recreation Day'
- given:
date: '2014-11-03'
regions: ["au_tas_north"]
expect:
name: 'Recreation Day'
- given:
date: '2015-11-02'
regions: ["au_tas_north"]
expect:
name: 'Recreation Day'
- given:
date: '2016-11-07'
regions: ["au_tas_north"]
expect:
name: 'Recreation Day'
- given:
date: '2015-12-26'
regions: ["au_tas"]
expect:
holiday: false
- given:
date: '2015-11-14'
regions: ["au_qld_brisbane"]
expect:
holiday: false
- given:
date: '2015-12-26'
regions: ["au_nt"]
expect:
holiday: false
- given:
date: '2016-12-27'
regions: ["au_sa"]
expect:
name: 'Proclamation Day'
- given:
date: '2016-12-25'
regions: ["au_nt"]
expect:
name: 'Christmas Day'
- given:
date: '2014-11-04'
regions: ["au_vic"]
expect:
holiday: false
- given:
date: '2015-11-03'
regions: ["au_vic"]
expect:
holiday: false
- given:
date: '2016-12-25'
regions: ["au_vic"]
expect:
name: 'Christmas Day'
- given:
date: '2014-05-19'
regions: ["au_sa"]
expect:
holiday: false
- given:
date: '2005-03-14'
regions: ["au_sa"]
expect:
holiday: false
- given:
date: '2015-12-26'
regions: ["au_sa"]
expect:
holiday: false
- given:
date: '2015-04-27'
regions: ["au_qld"]
options: ["observed"]
expect:
holiday: false
- given:
date: '2014-11-14'
regions: ["au_qld"]
expect:
holiday: false
- given:
date: '2014-11-04'
regions: ["au_vic_melbourne"]
expect:
name: 'Melbourne Cup Day'
- given:
date: '2015-11-03'
regions: ["au_vic_melbourne"]
expect:
name: 'Melbourne Cup Day'
- given:
date: '2015-10-02'
regions: ["au_vic"]
expect:
name: 'Friday before the AFL Grand Final'
- given:
date: '2016-09-30'
regions: ["au_vic"]
expect:
name: 'Friday before the AFL Grand Final'
- given:
date: '2017-09-29'
regions: ["au_vic"]
expect:
name: 'Friday before the AFL Grand Final'
- given:
date: '2005-05-16'
regions: ["au_sa"]
expect:
name: 'May Public Holiday'
- given:
date: '2014-03-10'
regions: ["au_sa"]
expect:
name: 'March Public Holiday'
- given:
date: '2015-03-09'
regions: ["au_sa"]
expect:
name: 'March Public Holiday'
- given:
date: '2016-03-14'
regions: ["au_sa"]
expect:
name: 'March Public Holiday'
- given:
date: '2017-03-13'
regions: ["au_sa"]
expect:
name: 'March Public Holiday'
- given:
date: '2015-04-25'
regions: ["au_qld", "au_wa"]
expect:
name: 'ANZAC Day'
- given:
date: '2015-04-27'
regions: ["au_wa"]
options: ["observed"]
expect:
name: 'ANZAC Day'
- given:
date: '2015-12-26'
regions: ["au_qld"]
expect:
name: "Boxing Day"
- given:
date: '2015-12-28'
regions: ["au_qld"]
options: ["observed"]
expect:
name: "Boxing Day"
- given:
date: '2015-12-26'
regions: ["au_sa"]
expect:
holiday: false
- given:
date: '2015-12-28'
regions: ["au_sa"]
expect:
name: "Proclamation Day"
- given:
date: '2015-12-26'
regions: ["au_tas"]
expect:
holiday: false
- given:
date: '2015-12-28'
regions: ["au_tas"]
expect:
name: "Boxing Day"
- given:
date: '2015-12-26'
regions: ["au_nt"]
expect:
holiday: false
- given:
date: '2015-12-28'
regions: ["au_nt"]
expect:
name: "Boxing Day"
- given:
date: '2012-02-13'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Regatta'
- given:
date: '2014-02-10'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Regatta'
- given:
date: '2015-02-09'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Regatta'
- given:
date: '2016-02-08'
regions: ["au_tas_south"]
expect:
name: 'Royal Hobart Regatta'
- given:
date: '2016-12-25'
regions: ["au_qld"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_qld"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_nsw"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_nsw"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_act"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_act"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_tas"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_tas"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_wa"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_wa"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_sa"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-26'
regions: ["au_sa"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_nsw"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_nsw"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_act"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_act"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_tas"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_tas"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_wa"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_wa"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-25'
regions: ["au_sa"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-26'
regions: ["au_sa"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_vic"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2016-12-27'
regions: ["au_nt"]
options: ["observed"]
expect:
name: 'Christmas Day'
- given:
date: '2017-01-01'
regions: ["au", "au_qld", "au_nsw", "au_act", "au_vic", "au_sa", "au_wa", "au_nt"]
expect:
name: "New Year's Day"
#FIXME This commented test is valid but the current code in the ruby repo won't allow it
# to work. We need to discuss potential solutions but in the meantime I'm taking it out.
# See https://github.com/holidays/definitions/issues/37.
# - given:
# date: '2017-01-01'
# regions: ["au_tas"]
# expect:
# holiday: false
- given:
date: '2017-01-02'
regions: ["au", "au_qld", "au_nsw", "au_act", "au_vic", "au_sa", "au_wa", "au_nt"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2017-01-02'
regions: ["au_tas"]
expect:
name: "New Year's Day"
- given:
date: '2016-03-27'
regions: ["au_qld"]
expect:
holiday: false
- given:
date: '2017-04-16'
regions: ["au_qld"]
expect:
name: "Easter Sunday"
- given:
date: "2014-11-14"
regions: ["au_qld_brisbane"]
expect:
name: "G20 Day"

153
vendor/holidays/definitions/be_fr.yaml vendored Normal file
View File

@ -0,0 +1,153 @@
# Belgium holiday definitions for the Ruby Holiday gem in French.
#
# Updated: 2012-06-20.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Belgium
---
months:
0:
- name: Pâques
regions: ['be_fr']
function: easter(year)
- name: Lundi de Pâques
regions: ['be_fr']
function: easter(year)
function_modifier: 1
- name: Ascension
regions: ['be_fr']
function: easter(year)
function_modifier: 39
- name: Pentecôte
regions: ['be_fr']
function: easter(year)
function_modifier: 49
- name: Lundi de Pentecôte
regions: ['be_fr']
function: easter(year)
function_modifier: 50
1:
- name: Jour de l'an
regions: ['be_fr']
mday: 1
5:
- name: Fête du travail
regions: ['be_fr']
mday: 1
7:
- name: Fête nationale
regions: ['be_fr']
mday: 21
8:
- name: Assomption
regions: ['be_fr']
mday: 15
11:
- name: Toussaint
regions: ['be_fr']
mday: 1
- name: Armistice 1918
regions: ['be_fr']
mday: 11
12:
- name: Noël
regions: ['be_fr']
mday: 25
tests:
- given:
date: '2007-01-01'
regions: ['be_fr']
options: ["informal"]
expect:
name: "Jour de l'an"
- given:
date: '2007-04-08'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Pâques'
- given:
date: '2007-04-09'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Lundi de Pâques'
- given:
date: '2007-05-01'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Fête du travail'
- given:
date: '2007-05-17'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Ascension'
- given:
date: '2007-05-27'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Pentecôte'
- given:
date: '2007-05-28'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Lundi de Pentecôte'
- given:
date: '2007-07-21'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Fête nationale'
- given:
date: '2007-08-15'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Assomption'
- given:
date: '2007-11-01'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Toussaint'
- given:
date: '2007-11-11'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Armistice 1918'
- given:
date: '2007-12-25'
regions: ['be_fr']
options: ["informal"]
expect:
name: 'Noël'
- given:
date: '2017-4-16'
regions: ['be_fr']
expect:
name: 'Pâques'
- given:
date: '2017-4-17'
regions: ['be_fr']
expect:
name: 'Lundi de Pâques'
- given:
date: '2017-5-25'
regions: ['be_fr']
expect:
name: 'Ascension'
- given:
date: '2017-6-4'
regions: ['be_fr']
expect:
name: 'Pentecôte'
- given:
date: '2017-6-5'
regions: ['be_fr']
expect:
name: 'Lundi de Pentecôte'

153
vendor/holidays/definitions/be_nl.yaml vendored Normal file
View File

@ -0,0 +1,153 @@
# Belgium holiday definitions for the Ruby Holiday gem. In Dutch.
#
# Updated: 2016-02-17.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Belgium
---
months:
0:
- name: Pasen
regions: [be_nl]
function: easter(year)
- name: Paasmaandag
regions: [be_nl]
function: easter(year)
function_modifier: 1
- name: O.H. Hemelvaart
regions: [be_nl]
function: easter(year)
function_modifier: 39
- name: Pinksteren
regions: [be_nl]
function: easter(year)
function_modifier: 49
- name: Pinkstermaandag
regions: [be_nl]
function: easter(year)
function_modifier: 50
1:
- name: Nieuwjaar
regions: [be_nl]
mday: 1
5:
- name: Feest van de Arbeid
regions: [be_nl]
mday: 1
7:
- name: Nationale Feestdag
regions: [be_nl]
mday: 21
8:
- name: O.L.V. Hemelvaart
regions: [be_nl]
mday: 15
11:
- name: Allerheiligen
regions: [be_nl]
mday: 1
- name: Wapenstilstand 1918
regions: [be_nl]
mday: 11
12:
- name: Kerstmis
regions: [be_nl]
mday: 25
tests:
- given:
date: '2007-01-01'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Nieuwjaar'
- given:
date: '2007-04-08'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Pasen'
- given:
date: '2007-04-09'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Paasmaandag'
- given:
date: '2007-05-01'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Feest van de Arbeid'
- given:
date: '2007-05-17'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'O.H. Hemelvaart'
- given:
date: '2007-05-27'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Pinksteren'
- given:
date: '2007-05-28'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Pinkstermaandag'
- given:
date: '2007-07-21'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Nationale Feestdag'
- given:
date: '2007-08-15'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'O.L.V. Hemelvaart'
- given:
date: '2007-11-01'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Allerheiligen'
- given:
date: '2007-11-11'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Wapenstilstand 1918'
- given:
date: '2007-12-25'
regions: ["be_nl"]
options: ["informal"]
expect:
name: 'Kerstmis'
- given:
date: '2017-4-16'
regions: ['be_nl']
expect:
name: 'Pasen'
- given:
date: '2017-4-17'
regions: ['be_nl']
expect:
name: 'Paasmaandag'
- given:
date: '2017-5-25'
regions: ['be_nl']
expect:
name: 'O.H. Hemelvaart'
- given:
date: '2017-6-4'
regions: ['be_nl']
expect:
name: 'Pinksteren'
- given:
date: '2017-6-5'
regions: ['be_nl']
expect:
name: 'Pinkstermaandag'

186
vendor/holidays/definitions/bg.yaml vendored Normal file
View File

@ -0,0 +1,186 @@
# Bulgaria holiday definitions for the Ruby Holiday gem.
#
# Updated: 2015-04-01.
# Source: http://en.wikipedia.org/wiki/Public_holidays_in_Bulgaria
---
months:
0:
- name: Good Friday
regions: [bg_en]
function: orthodox_easter_julian(year)
function_modifier: -2
- name: Разпети петък
regions: [bg_bg]
function: orthodox_easter_julian(year)
function_modifier: -2
- name: Holy Saturday
regions: [bg_en]
function: orthodox_easter_julian(year)
function_modifier: -1
- name: Велика събота
regions: [bg_bg]
function: orthodox_easter_julian(year)
function_modifier: -1
- name: Easter Sunday
regions: [bg_en]
function: orthodox_easter_julian(year)
- name: Възкресение Христово. Великден
regions: [bg_bg]
function: orthodox_easter_julian(year)
- name: Easter Monday
regions: [bg_en]
function: orthodox_easter_julian(year)
function_modifier: 1
- name: Възкресение Христово. Великден
regions: [bg_bg]
function: orthodox_easter_julian(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [bg_en]
mday: 1
- name: Нова година
regions: [bg_bg]
mday: 1
3:
- name: Liberation Day
regions: [bg_en]
mday: 3
- name: Освобожението на България
regions: [bg_bg]
mday: 3
5:
- name: Labour Day
regions: [bg_en]
mday: 1
- name: Ден на труда
regions: [bg_bg]
mday: 1
- name: St. George's Day
regions: [bg_en]
mday: 6
- name: Гергьовден. Ден на храбростта
regions: [bg_bg]
mday: 6
- name: Slavic Literacy Day
regions: [bg_en]
mday: 24
- name: Ден на славянската писменост
regions: [bg_bg]
mday: 24
9:
- name: Unification Day
regions: [bg_en]
mday: 6
- name: Ден на Съединението
regions: [bg_bg]
mday: 6
- name: The Independence Day
regions: [bg_en]
mday: 22
- name: Ден на Независимостта
regions: [bg_bg]
mday: 22
11:
- name: Revival Leader's Day
regions: [bg_en]
mday: 1
- name: Ден на Народните будители
regions: [bg_bg]
mday: 1
12:
- name: Christmas Eve
regions: [bg_en]
mday: 24
- name: Бъдни вечер
regions: [bg_bg]
mday: 24
- name: Christmas
regions: [bg_en]
mday: 25
- name: Рождество Христово. Коледа
regions: [bg_bg]
mday: 25
- name: Christmas
regions: [bg_en]
mday: 26
- name: Рождество Христово. Коледа
regions: [bg_bg]
mday: 26
tests:
- given:
date: '2015-01-01'
regions: ["bg_en"]
expect:
name: "New Year's Day"
- given:
date: '2015-03-03'
regions: ["bg_en"]
expect:
name: 'Liberation Day'
- given:
date: '2015-03-28'
regions: ["bg_en"]
expect:
name: 'Good Friday'
- given:
date: '2015-03-29'
regions: ["bg_en"]
expect:
name: 'Holy Saturday'
- given:
date: '2015-03-30'
regions: ["bg_en"]
expect:
name: 'Easter Sunday'
- given:
date: '2015-03-31'
regions: ["bg_en"]
expect:
name: 'Easter Monday'
- given:
date: '2015-05-01'
regions: ["bg_en"]
expect:
name: 'Labour Day'
- given:
date: '2015-05-06'
regions: ["bg_en"]
expect:
name: "St. George's Day"
- given:
date: '2015-05-24'
regions: ["bg_en"]
expect:
name: 'Slavic Literacy Day'
- given:
date: '2015-09-06'
regions: ["bg_en"]
expect:
name: 'Unification Day'
- given:
date: '2015-09-22'
regions: ["bg_en"]
expect:
name: 'The Independence Day'
- given:
date: '2015-11-01'
regions: ["bg_en"]
expect:
name: "Revival Leader's Day"
- given:
date: '2015-12-24'
regions: ["bg_en"]
expect:
name: 'Christmas Eve'
- given:
date: '2015-12-25'
regions: ["bg_en"]
expect:
name: 'Christmas'
- given:
date: '2015-12-26'
regions: ["bg_en"]
expect:
name: 'Christmas'

161
vendor/holidays/definitions/br.yaml vendored Normal file
View File

@ -0,0 +1,161 @@
# Brazilian holiday definitions for the Ruby Holiday gem.
# Provided by Rogério Carrasqueira
#
# Updated: 2008-11-28.
# Sources:
# - http://pt.wikipedia.org/wiki/Feriados_no_Brasil
---
months:
0:
- name: Carnaval # same as Shrove Tuesday
regions: [br]
function: easter(year)
function_modifier: -47
type: informal
- name: Sexta-feira Santa
regions: [br]
function: easter(year)
function_modifier: -2
- name: Páscoa
regions: [br]
function: easter(year)
- name: Corpus Christi
regions: [br]
function: easter(year)
function_modifier: 60
1:
- name: Dia da Confraternização Universal
regions: [br]
mday: 1
4:
- name: Dia de Tiradentes
regions: [br]
mday: 21
5:
- name: Dia do Trabalho
regions: [br]
mday: 1
9:
- name: Proclamação da Independência
regions: [br]
mday: 7
10:
- name: Dia de Nossa Senhora Aparecida
regions: [br]
mday: 12
11:
- name: Dia de Finados
regions: [br]
mday: 2
- name: Proclamação da República
regions: [br]
mday: 15
12:
- name: Natal
regions: [br]
mday: 25
tests:
- given:
date: '2008-01-01'
regions: ["br"]
options: ["informal"]
expect:
name: "Dia da Confraternização Universal"
- given:
date: '2005-02-08'
regions: ["br"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2006-02-28'
regions: ["br"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2007-02-20'
regions: ["br"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2008-02-05'
regions: ["br"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2008-03-21'
regions: ["br"]
options: ["informal"]
expect:
name: "Sexta-feira Santa"
- given:
date: '2008-03-23'
regions: ["br"]
options: ["informal"]
expect:
name: "Páscoa"
- given:
date: '2008-04-21'
regions: ["br"]
options: ["informal"]
expect:
name: "Dia de Tiradentes"
- given:
date: '2008-05-01'
regions: ["br"]
options: ["informal"]
expect:
name: "Dia do Trabalho"
- given:
date: '2005-05-26'
regions: ["br"]
options: ["informal"]
expect:
name: "Corpus Christi"
- given:
date: '2007-06-07'
regions: ["br"]
options: ["informal"]
expect:
name: "Corpus Christi"
- given:
date: '2008-05-22'
regions: ["br"]
options: ["informal"]
expect:
name: "Corpus Christi"
- given:
date: '2008-09-07'
regions: ["br"]
options: ["informal"]
expect:
name: "Proclamação da Independência"
- given:
date: '2008-10-12'
regions: ["br"]
options: ["informal"]
expect:
name: "Dia de Nossa Senhora Aparecida"
- given:
date: '2008-11-02'
regions: ["br"]
options: ["informal"]
expect:
name: "Dia de Finados"
- given:
date: '2008-11-15'
regions: ["br"]
options: ["informal"]
expect:
name: "Proclamação da República"
- given:
date: '2008-12-25'
regions: ["br"]
options: ["informal"]
expect:
name: "Natal"

881
vendor/holidays/definitions/ca.yaml vendored Normal file
View File

@ -0,0 +1,881 @@
# Canadian holiday definitions for the Ruby Holiday gem.
# Updated 2020-03-18.
#
# Notes:
# - 'Family Day' in various provinces are only celebrated after certain years: http://www.timeanddate.com/holidays/canada/family-day
# - 'Family Day' for New Brunswick after 2018 http://www.gnb.ca/legis/bill/FILE/58/3/Bill-67-e.htm
# - 'National Aboriginal Day for Yukon' Bill 2 received Royal Assent on May 8, 2017. http://www.gov.yk.ca/news/17-075.html
# - 'Nunavuts legislative assembly voted to pass Bill 29 making Nunavut Day', July 9, an officially statutory holiday across the territory. https://www.gov.nu.ca/human-resources/information/public-service-holidays
# - 'According to Manitoba labour standards, Terry Fox Day is not a formal holiday. https://www.gov.mb.ca/labour/standards/doc,gen-holidays-after-april-30-07,factsheet.html#q13'
---
months:
0:
- name: Good Friday
regions: [ca]
function: easter(year)
function_modifier: -2
- name: Easter Sunday
regions: [ca]
function: easter(year)
type: informal
- name: Easter Monday
regions: [ca]
function: easter(year)
function_modifier: 1
type: informal
1:
- name: New Year's Day
regions: [ca]
mday: 1
observed: to_monday_if_weekend(date)
- name: New Year's
regions: [ca_qc]
mday: 2
2:
- name: Family Day
regions: [ca_ab]
wday: 1
week: 3
year_ranges:
from: 1990
- name: Family Day
regions: [ca_sk]
wday: 1
week: 3
year_ranges:
from: 2007
- name: Family Day
regions: [ca_on]
wday: 1
week: 3
year_ranges:
from: 2008
- name: Family Day
regions: [ca_bc]
wday: 1
week: 2
year_ranges:
between:
start: 2013
end: 2018
- name: Family Day
regions: [ca_bc]
wday: 1
week: 3
year_ranges:
from: 2019
- name: Family Day
regions: [ca_nb]
wday: 1
week: 3
year_ranges:
from: 2018
- name: Louis Riel Day
regions: [ca_mb]
wday: 1
week: 3
- name: Nova Scotia Heritage Day
regions: [ca_ns]
wday: 1
week: 3
year_ranges:
from: 2015
- name: Islander Day
regions: [ca_pe]
wday: 1
week: 3
3:
- name: St. Patrick's Day
regions: [ca_nl]
mday: 17
type: informal
- name: St. George's Day
regions: [ca_nl]
mday: 23
type: informal
5:
- name: Victoria Day
regions: [ca_ab, ca_bc, ca_mb, ca_nt, ca_nu, ca_on, ca_sk, ca_yt]
function: ca_victoria_day(year)
- name: National Patriotes Day
regions: [ca_qc]
function: ca_victoria_day(year)
6:
- name: Discovery Day
regions: [ca_nl]
mday: 24
type: informal
- name: Fête Nationale
regions: [ca_qc]
mday: 24
- name: National Aboriginal Day
regions: [ca_nt]
mday: 21
- name: National Aboriginal Day
regions: [ca_yt]
mday: 21
year_ranges:
from: 2017
7:
- name: Canada Day
regions: [ca]
mday: 1
observed: to_monday_if_weekend(date)
- name: Orangemen's Day
regions: [ca_nl]
mday: 12
type: informal
- name: Nunavut Day
regions: [ca_nu]
mday: 9
observed: to_monday_if_weekend(date)
year_ranges:
from: 2020
8:
- name: B.C. Day
week: 1
regions: [ca_bc]
wday: 1
- name: Saskatchewan Day
week: 1
regions: [ca_sk]
wday: 1
- name: Heritage Day
week: 1
regions: [ca_ab]
type: informal
wday: 1
- name: Natal Day
week: 1
regions: [ca_ns]
wday: 1
type: informal
- name: Civic Holiday
week: 1
regions: [ca_nt, ca_nu]
wday: 1
- name: Civic Holiday
week: 1
regions: [ca_on, ca_pe]
wday: 1
type: informal
- name: New Brunswick Day
week: 1
regions: [ca_nb]
wday: 1
- name: Terry Fox Day
week: 1
regions: [ca_mb]
wday: 1
type: informal
- name: Discovery Day
week: 3
regions: [ca_yt]
wday: 1
9:
- name: Labour Day
week: 1
regions: [ca]
wday: 1
10:
- name: Thanksgiving
week: 2
regions: [ca_ab, ca_bc, ca_mb, ca_nt, ca_nu, ca_on, ca_qc, ca_sk, ca_yt]
wday: 1
11:
- name: Remembrance Day
regions: [ca_ab, ca_sk, ca_bc, ca_pe, ca_nl, ca_nt, ca_nu, ca_nb, ca_yt]
mday: 11
observed: to_monday_if_weekend(date)
12:
- name: Christmas Day
regions: [ca]
mday: 25
observed: to_weekday_if_weekend(date)
- name: Boxing Day
regions: [ca_on]
mday: 26
observed: to_weekday_if_boxing_weekend(date)
- name: Boxing Day
regions: [ca_ab, ca_bc, ca_mb, ca_nb, ca_nl, ca_nt, ca_ns, ca_nu, ca_pe, ca_sk, ca_yt]
mday: 26
observed: to_weekday_if_boxing_weekend(date)
type: informal
methods:
ca_victoria_day:
# Monday on or before May 24
arguments: year
ruby: |
date = Date.civil(year,5,24)
if date.wday > 1
date -= (date.wday - 1)
elsif date.wday == 0
date -= 6
end
date
tests:
- given:
date: '2008-01-01'
regions: ["ca"]
options: ["informal"]
expect:
name: "New Year's Day"
- given:
date: '2008-03-21'
regions: ["ca"]
options: ["informal"]
expect:
name: "Good Friday"
- given:
date: '2013-03-31'
regions: ["ca"]
options: ["informal"]
expect:
name: "Easter Sunday"
- given:
date: '2008-03-24'
regions: ["ca"]
options: ["informal"]
expect:
name: "Easter Monday"
- given:
date: '2008-07-01'
regions: ["ca"]
options: ["informal"]
expect:
name: "Canada Day"
- given:
date: '2008-09-01'
regions: ["ca"]
options: ["informal"]
expect:
name: "Labour Day"
- given:
date: '2008-12-25'
regions: ["ca"]
options: ["informal"]
expect:
name: "Christmas Day"
# Family Day in Alberta - Should only be active on 1990 or later
- given:
date: '1990-02-19'
regions: ["ca_ab"]
expect:
name: "Family Day"
- given:
date: '2013-02-18'
regions: ["ca_ab"]
expect:
name: "Family Day"
- given:
date: '2014-02-17'
regions: ["ca_ab"]
expect:
name: "Family Day"
- given:
date: '2044-02-15'
regions: ["ca_ab"]
expect:
name: "Family Day"
# Family Day in Alberta - should not be active before 1990
- given:
date: '1970-02-16'
regions: ["ca_ab"]
expect:
holiday: false
- given:
date: '1988-02-15'
regions: ["ca_ab"]
expect:
holiday: false
- given:
date: '1989-02-20'
regions: ["ca_ab"]
expect:
holiday: false
# Family Day in Saskatchewan - Should only be active on 2007 or later
- given:
date: '2007-02-19'
regions: ["ca_sk"]
expect:
name: "Family Day"
- given:
date: '2013-02-18'
regions: ["ca_sk"]
expect:
name: "Family Day"
- given:
date: '2014-02-17'
regions: ["ca_sk"]
expect:
name: "Family Day"
- given:
date: '2044-02-15'
regions: ["ca_sk"]
expect:
name: "Family Day"
# Family Day in Saskatchewan - should not be active before 2007
- given:
date: '1970-02-16'
regions: ["ca_sk"]
expect:
holiday: false
- given:
date: '1988-02-15'
regions: ["ca_sk"]
expect:
holiday: false
- given:
date: '1989-02-20'
regions: ["ca_sk"]
expect:
holiday: false
- given:
date: '2006-02-20'
regions: ["ca_sk"]
expect:
holiday: false
# Family Day in Ontario - Should only be active on 2008 or later
- given:
date: '2008-02-18'
regions: ["ca_on"]
expect:
name: "Family Day"
- given:
date: '2013-02-18'
regions: ["ca_on"]
expect:
name: "Family Day"
- given:
date: '2014-02-17'
regions: ["ca_on"]
expect:
name: "Family Day"
- given:
date: '2044-02-15'
regions: ["ca_on"]
expect:
name: "Family Day"
# Family Day in Ontario - should not be active before 2008
- given:
date: '1970-02-16'
regions: ["ca_on"]
expect:
holiday: false
- given:
date: '1988-02-15'
regions: ["ca_on"]
expect:
holiday: false
- given:
date: '1989-02-20'
regions: ["ca_on"]
expect:
holiday: false
- given:
date: '2006-02-20'
regions: ["ca_on"]
expect:
holiday: false
- given:
date: '2007-02-19'
regions: ["ca_on"]
expect:
holiday: false
# Family Day in BC on 2nd week - Should only be active between 2013 and 2018
- given:
date: '2013-02-11'
regions: ["ca_bc"]
expect:
name: "Family Day"
- given:
date: '2014-02-10'
regions: ["ca_bc"]
expect:
name: "Family Day"
- given:
date: '2018-02-12'
regions: ["ca_bc"]
expect:
name: "Family Day"
# Family Day in BC on 2nd week - Should not be active before 2013 and after 2018
- given:
date: '2000-02-14'
regions: ["ca_bc"]
expect:
holiday: false
- given:
date: '2011-02-14'
regions: ["ca_bc"]
expect:
holiday: false
- given:
date: '2012-02-13'
regions: ["ca_bc"]
expect:
holiday: false
- given:
date: '2019-02-11'
regions: ["ca_bc"]
expect:
holiday: false
- given:
date: '2044-02-08'
regions: ["ca_bc"]
expect:
holiday: false
# Family Day in BC on 3nd week - Should only be active after 2018
- given:
date: '2019-02-18'
regions: ["ca_bc"]
expect:
name: "Family Day"
- given:
date: '2020-02-17'
regions: ["ca_bc"]
expect:
name: "Family Day"
- given:
date: '2044-02-15'
regions: ["ca_bc"]
expect:
name: "Family Day"
# Family Day in BC on 3nd week - Should not be active before 2019
- given:
date: '2000-02-21'
regions: ["ca_bc"]
expect:
holiday: false
- given:
date: '2011-02-21'
regions: ["ca_bc"]
expect:
holiday: false
- given:
date: '2018-02-19'
regions: ["ca_bc"]
expect:
holiday: false
# Family Day in NB - Should only be active on 2018 or later
- given:
date: '2018-02-19'
regions: ['ca_nb']
expect:
name: 'Family Day'
- given:
date: '2019-02-18'
regions: ['ca_nb']
expect:
name: 'Family Day'
# Family Day in NB - should not be active before 2018
- given:
date: '2016-02-18'
regions: ['ca_nb']
expect:
holiday: false
- given:
date: '2017-02-20'
regions: ['ca_nb']
expect:
holiday: false
# Nova Scotia Heritage Day - should only be active on 2015 and later
- given:
date: '2015-02-16'
regions: ["ca_ns"]
expect:
name: "Nova Scotia Heritage Day"
- given:
date: '2016-02-15'
regions: ["ca_ns"]
expect:
name: "Nova Scotia Heritage Day"
- given:
date: '2017-02-20'
regions: ["ca_ns"]
expect:
name: "Nova Scotia Heritage Day"
- given:
date: '2044-02-15'
regions: ["ca_ns"]
expect:
name: "Nova Scotia Heritage Day"
# Nova Scotia Heritage Day - should not be active before 2015
- given:
date: '2000-02-21'
regions: ["ca_ns"]
expect:
holiday: false
- given:
date: '2012-02-20'
regions: ["ca_ns"]
expect:
holiday: false
- given:
date: '2013-02-18'
regions: ["ca_ns"]
expect:
holiday: false
- given:
date: '2014-02-17'
regions: ["ca_ns"]
expect:
holiday: false
- given:
date: '2013-02-18'
regions: ["ca_pe"]
expect:
name: "Islander Day"
- given:
date: '2014-02-17'
regions: ["ca_pe"]
expect:
name: "Islander Day"
- given:
date: ['2004-05-24', '2005-5-23', '2006-5-22', '2007-5-21', '2008-5-19']
regions: ["ca_ab", "ca_bc", "ca_mb", "ca_nt", "ca_nu", "ca_on", "ca_sk", "ca_yt"]
expect:
name: "Victoria Day"
# First Monday in August
- given:
date: '2013-08-05'
regions: ["ca_bc"]
expect:
name: "B.C. Day"
- given:
date: '2013-08-05'
regions: ["ca_sk"]
expect:
name: "Saskatchewan Day"
- given:
date: '2013-08-05'
regions: ["ca_ab"]
options: ["informal"]
expect:
name: "Heritage Day"
- given:
date: '2013-08-05'
regions: ["ca_ns"]
options: ["informal"]
expect:
name: "Natal Day"
- given:
date: ['2013-08-05', '2014-8-4', '2015-8-3']
regions: ["ca_on"]
options: ["informal"]
expect:
name: "Civic Holiday"
- given:
date: '2013-08-05'
regions: ["ca_nt"]
expect:
name: "Civic Holiday"
- given:
date: '2013-08-05'
regions: ["ca_nu"]
expect:
name: "Civic Holiday"
- given:
date: '2013-08-05'
regions: ["ca_pe"]
options: ["informal"]
expect:
name: "Civic Holiday"
- given:
date: '2013-08-05'
regions: ["ca_nb"]
expect:
name: "New Brunswick Day"
- given:
date: '2014-08-04'
regions: ["ca_bc"]
expect:
name: "B.C. Day"
- given:
date: '2014-08-04'
regions: ["ca_sk"]
expect:
name: "Saskatchewan Day"
- given:
date: '2014-08-04'
regions: ["ca_ab"]
options: ["informal"]
expect:
name: "Heritage Day"
- given:
date: '2014-08-04'
regions: ["ca_ns"]
options: ["informal"]
expect:
name: "Natal Day"
- given:
date: '2014-08-04'
regions: ["ca_nt"]
expect:
name: "Civic Holiday"
- given:
date: '2014-08-04'
regions: ["ca_nu"]
expect:
name: "Civic Holiday"
- given:
date: '2014-08-04'
regions: ["ca_pe"]
options: ["informal"]
expect:
name: "Civic Holiday"
- given:
date: '2014-08-04'
regions: ["ca_nb"]
expect:
name: "New Brunswick Day"
- given:
date: '2015-08-03'
regions: ["ca_bc"]
expect:
name: "B.C. Day"
- given:
date: '2015-08-03'
regions: ["ca_sk"]
expect:
name: "Saskatchewan Day"
- given:
date: '2015-08-03'
regions: ["ca_ab"]
options: ["informal"]
expect:
name: "Heritage Day"
- given:
date: '2015-08-03'
regions: ["ca_ns"]
options: ["informal"]
expect:
name: "Natal Day"
- given:
date: '2015-08-03'
regions: ["ca_nt"]
expect:
name: "Civic Holiday"
- given:
date: '2015-08-03'
regions: ["ca_nu"]
expect:
name: "Civic Holiday"
- given:
date: '2015-08-03'
regions: ["ca_pe"]
options: ["informal"]
expect:
name: "Civic Holiday"
- given:
date: '2015-08-03'
regions: ["ca_nb"]
expect:
name: "New Brunswick Day"
# Remembrance Day in all Canadian provinces
# except (Nova Scotia, Manitoba, Ontario, and Quebec)
- given:
date: ['2010-11-11', '2012-11-12', '2017-11-13']
regions: ["ca_ab", "ca_sk", "ca_bc", "ca_pe", "ca_nl", "ca_nt", "ca_nu", "ca_nb", "ca_yt"]
options: ["observed"]
expect:
name: "Remembrance Day"
- given:
date: '2016-11-11'
regions: ["ca_ab", "ca_sk", "ca_bc", "ca_pe", "ca_nl", "ca_nt", "ca_nu", "ca_nb", "ca_yt"]
expect:
name: "Remembrance Day"
# New years observed date
- given:
date: '2011-01-03'
regions: ["ca"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2012-01-02'
regions: ["ca"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2016-01-01'
regions: ["ca"]
options: ["observed"]
expect:
name: "New Year's Day"
# Canada Day observed date
- given:
date: '2011-07-01'
regions: ["ca"]
options: ["observed"]
expect:
name: "Canada Day"
- given:
date: '2012-07-02'
regions: ["ca"]
options: ["observed"]
expect:
name: "Canada Day"
- given:
date: '2017-07-03'
regions: ["ca"]
options: ["observed"]
expect:
name: "Canada Day"
# Christmas Day
- given:
date: '2010-12-25'
regions: ["ca"]
expect:
name: "Christmas Day"
- given:
date: '2018-12-25'
regions: ["ca"]
expect:
name: "Christmas Day"
- given:
date: '2022-12-25'
regions: ["ca"]
expect:
name: "Christmas Day"
- given:
date: '2022-12-25'
regions: ["ca"]
options: ["observed"]
expect:
holiday: false
# Christmas Day observed date
- given:
date: '2010-12-24'
regions: ["ca"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2012-12-25'
regions: ["ca"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2016-12-26'
regions: ["ca"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2021-12-24'
regions: ["ca"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2022-12-26'
regions: ["ca"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: ['2010-12-28', '2012-12-26', '2015-12-28', '2016-12-27']
regions: ["ca_on"]
options: ["observed"]
expect:
name: "Boxing Day"
# Yukon National Aboriginal Day - should not be active before 2017
- given:
date: '2015-06-21'
regions: ['ca_yt']
expect:
holiday: false
- given:
date: '2016-06-21'
regions: ['ca_yt']
expect:
holiday: false
# Yukon National Aboriginal Day - should be active after 2017
- given:
date: '2017-06-21'
regions: ['ca_yt']
expect:
name: 'National Aboriginal Day'
- given:
date: '2018-06-21'
regions: ['ca_yt']
expect:
name: 'National Aboriginal Day'
- given:
date: '2019-08-05'
regions: ['ca_mb']
options: ['informal']
expect:
name: 'Terry Fox Day'
- given:
date: '2020-08-03'
regions: ['ca_mb']
options: ['informal']
expect:
name: 'Terry Fox Day'
- given:
date: '2020-08-03'
regions: ['ca_mb']
expect:
holiday: false
- given:
date: '2015-08-03'
regions: ['ca_mb']
options: ['informal']
expect:
name: 'Terry Fox Day'
- given:
date: '2045-08-07'
regions: ['ca_mb']
options: ['informal']
expect:
name: 'Terry Fox Day'
# Nunavut Day, July 9 - Should only be active on 2020 or later
- given:
date: '2020-07-09'
regions: ['ca_nu']
expect:
name: 'Nunavut Day'
- given:
date: '2021-07-09'
regions: ['ca_nu']
expect:
name: 'Nunavut Day'
# Nunavut Day, July 9 - should NOT be active before 2020
- given:
date: '2019-07-09'
regions: ['ca_nu']
expect:
holiday: false
- given:
date: '2018-07-09'
regions: ['ca_nu']
expect:
holiday: false

277
vendor/holidays/definitions/ch.yaml vendored Normal file
View File

@ -0,0 +1,277 @@
# Swiss holiday definitions for the Ruby Holiday gem.
#
# Updated: 2018-10-10.
# Sources:
# http://www.bj.admin.ch/content/dam/data/staat_buerger/zivilprozessrecht/kant-feiertage.pdf
#
# Word of warning:
# ================
# As the holidays are defined on a state level and sometimes even on a district / village level,
# this holiday definition is an approximation of the reality. It should be accurate for most of the cases but
# no guarantee is given that it is correct for all the special cases :-).
# Considers both official holidays and holidays that are handled as if they were official holidays.
#
# Holiday names are in German in case they are celebrated in the German speaking area and in French / Italian otherwise.
#
# Known Issues:
# * ch_ur: 26th of December is not celebrated in case the 25th is a Monday or a Friday.
# * ch_fr: Fronleichnam, Maria Himmelfahrt, Allerheiligen, Maria Empfaengnis is celebrated in all villages except
# some villages of the district of See.
# * ch_so: - There are a lot of village holidays not included here.
# - 1st of May is holiday only starting at noon; not included here.
# - 19th of March is celebrated only in a couple of villages
# * ch_ar: 26th of December is not celebrated in case the 25th is a Monday or a Friday.
# * ch_ai: - 22nd of September is celebrated only in part of the state.
# - 26th of December is not celebrated in case the 25th is a Monday or a Friday.
# * ch_ne: 26th of December and 2nd of January are only celebrated in case 25th of December and 1st of January are Sundays
---
months:
0:
- 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]
function: easter(year)
function_modifier: -2
- 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]
function: easter(year)
function_modifier: 1
# State holiday but observed in all the states
- name: Auffahrt
regions: [ch]
function: easter(year)
function_modifier: 39
- name: Pfingstmontag
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]
function: easter(year)
function_modifier: 50
- name: Fronleichnam
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_ne, ch_ju]
function: easter(year)
function_modifier: 60
- name: Lundi du Jeûne fédéral
regions: [ch_vd]
function: ch_vd_lundi_du_jeune_federal(year)
- name: Jeûne genevois
regions: [ch_ge]
function: ch_ge_jeune_genevois(year)
1:
- name: Neujahrstag
regions: [ch]
mday: 1
- 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]
mday: 2
- name: Dreikönigstag
regions: [ch_ur, ch_sz, ch_ti]
mday: 6
3:
- name: Instauration de la République
regions: [ch_ne]
mday: 1
- name: Josephstag
regions: [ch_ur, ch_sz, ch_nw, ch_ti, ch_vs]
mday: 19
4:
- name: Näfelser Fahrt
regions: [ch_gl]
function: ch_gl_naefelser_fahrt(year)
5:
- name: Tag der Arbeit
regions: [ch_zh, ch_bs, ch_bl, ch_sh, ch_ag, ch_tg, ch_ti, ch_ne, ch_ju]
mday: 1
6:
- name: Commémoration du plébiscite jurassien
regions: [ch_ju]
mday: 23
- name: San Pietro e Paolo
regions: [ch_ti]
mday: 29
8:
# Federal holiday
- name: Bundesfeiertag
regions: [ch]
mday: 1
- 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]
mday: 15
9:
- name: Mauritiustag
regions: [ch_ai]
mday: 22
- name: Bruderklausenfest
regions: [ch_ow]
mday: 25
11:
- name: Zibelemärit
regions: [ch_be]
function: ch_be_zibelemaerit(year)
- 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]
mday: 1
12:
- 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]
mday: 8
# State holiday but observed in all the states
- name: Weihnachten
regions: [ch]
mday: 25
- 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]
mday: 26
- name: Restauration de la République
regions: [ch_ge]
mday: 31
methods:
ch_vd_lundi_du_jeune_federal:
# Monday after the third Sunday of September
arguments: year
ruby: |
date = Date.civil(year,9,1)
# Find the first Sunday of September
until date.wday.eql? 0 do
date += 1
end
# There are 15 days between the first Sunday
# and the Monday after the third Sunday
date + 15
ch_ge_jeune_genevois:
# Thursday after the first Sunday of September
arguments: year
ruby: |
date = Date.civil(year,9,1)
# Find the first Sunday of September
until date.wday.eql? 0 do
date += 1
end
# Thursday is four days after Sunday
date + 4
ch_gl_naefelser_fahrt:
# First Thursday of April. If the first Thursday of April is in the week before easter, then a week later.
arguments: year
ruby: |
date = Date.civil(year,4,1)
# Find the first Thursday of April
until date.wday.eql? 4 do
date += 1
end
if date.eql?(Holidays::Factory::DateCalculator::Easter::Gregorian.easter_calculator.calculate_easter_for(year)-3)
date += 7
end
date
ch_be_zibelemaerit:
# fourth Monday in november
arguments: year
ruby: |
date = Date.civil(year,11,1)
# Find the first Monday of November
until date.wday.eql? 1 do
date += 1
end
# There are 21 days between the first monday
# and the 4rth Monday after
date + 21
tests:
- given:
date: '2018-01-01'
regions: ["ch"]
expect:
name: "Neujahrstag"
- given:
date: '2012-08-01'
regions: ["ch"]
expect:
name: "Bundesfeiertag"
- given:
date: '2012-12-25'
regions: ["ch"]
expect:
name: "Weihnachten"
- given:
date: '2012-05-17'
regions: ["ch"]
expect:
name: "Auffahrt"
- given:
date: '2012-08-01'
regions: ["ch_zh"]
expect:
name: "Bundesfeiertag"
- given:
date: '2012-12-25'
regions: ["ch_zh"]
expect:
name: "Weihnachten"
- given:
date: '2012-05-17'
regions: ["ch_zh"]
expect:
name: "Auffahrt"
- given:
date: '2012-05-01'
regions: ["ch_zh"]
expect:
name: "Tag der Arbeit"
- given:
date: '2012-12-26'
regions: ["ch_zh"]
expect:
name: "Stefanstag"
- given:
date: '2012-09-17'
regions: ["ch_vd"]
expect:
name: "Lundi du Jeûne fédéral"
- given:
date: '2013-09-16'
regions: ["ch_vd"]
expect:
name: "Lundi du Jeûne fédéral"
- given:
date: '2014-09-22'
regions: ["ch_vd"]
expect:
name: "Lundi du Jeûne fédéral"
- given:
date: '2012-09-06'
regions: ["ch_ge"]
expect:
name: "Jeûne genevois"
- given:
date: '2013-09-05'
regions: ["ch_ge"]
expect:
name: "Jeûne genevois"
- given:
date: '2014-09-11'
regions: ["ch_ge"]
expect:
name: "Jeûne genevois"
- given:
date: '2012-04-12'
regions: ["ch_gl"]
expect:
name: "Näfelser Fahrt"
- given:
date: '2013-04-04'
regions: ["ch_gl"]
expect:
name: "Näfelser Fahrt"
- given:
date: '2014-04-03'
regions: ["ch_gl"]
expect:
name: "Näfelser Fahrt"
- given:
date: '2014-11-24'
regions: ["ch_be"]
expect:
name: "Zibelemärit"
- given:
date: '2020-11-23'
regions: ["ch_be"]
expect:
name: "Zibelemärit"

294
vendor/holidays/definitions/cl.yaml vendored Normal file
View File

@ -0,0 +1,294 @@
# Chilean holiday definitions for the Ruby Holiday gem.
#
# Updated: 2019-02-10
#
# Sources:
# - http://www.feriados.cl
# - http://www.feriadoschilenos.cl
#
---
months:
0:
- name: Viernes Santo
regions: [cl]
function: easter(year)
function_modifier: -2
- name: Sábado Santo
regions: [cl]
function: easter(year)
function_modifier: -1
- name: San Pedro y San Pablo
regions: [cl]
function: st_peter_st_paul_cl(year)
year_ranges:
from: 2000
- name: Día de las Iglesias Evangélicas y Protestantes
regions: [cl]
function: other_churches_day_cl(year)
year_ranges:
from: 2008
1:
- name: Año Nuevo
regions: [cl]
mday: 1
5:
- name: Día del Trabajo
regions: [cl]
mday: 1
- name: Día de las Glorias Navales
regions: [cl]
mday: 21
6:
- name: San Pedro y San Pablo
regions: [cl]
mday: 29
year_ranges:
until: 1999
7:
- name: Día de la Virgen del Carmen
regions: [cl]
mday: 16
8:
- name: Asunción de la Virgen
regions: [cl]
mday: 15
9:
- name: Independencia Nacional
regions: [cl]
mday: 18
- name: Día de las Glorias del Ejército
regions: [cl]
mday: 19
10:
- name: Encuentro de Dos Mundos
regions: [cl]
mday: 12
year_ranges:
until: 1999
- name: Encuentro de Dos Mundos
regions: [cl]
year_ranges:
from: 2000
function: columbus_day_cl(year)
11:
- name: Día de Todos los Santos
regions: [cl]
mday: 1
12:
- name: Inmaculada Concepción de María
regions: [cl]
mday: 8
- name: Navidad
regions: [cl]
mday: 25
methods:
st_peter_st_paul_cl:
arguments: year
# Nearest monday
ruby: |
date = Date.civil(year, 6, 29)
if [2,3,4].include?(date.wday)
date -= (date.wday - 1)
elsif date.wday == 5
date += 3
end
date
columbus_day_cl:
arguments: year
# Nearest monday
ruby: |
date = Date.civil(year, 10, 12)
if [2,3,4].include?(date.wday)
date -= (date.wday - 1)
elsif date.wday == 5
date += 3
end
date
other_churches_day_cl:
arguments: year
# If on tuesday, friday before, if on wednesday, next friday
ruby: |
date = Date.civil(year, 10, 31)
if date.wday == 2
date -= 4
elsif date.wday == 3
date += 2
end
date
tests:
- given:
date: '2014-01-01'
regions: ["cl"]
options: ["informal"]
expect:
name: "Año Nuevo"
- given:
date: '2011-04-22'
regions: ["cl"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2011-04-23'
regions: ["cl"]
options: ["informal"]
expect:
name: "Sábado Santo"
- given:
date: '2012-04-06'
regions: ["cl"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2012-04-07'
regions: ["cl"]
options: ["informal"]
expect:
name: "Sábado Santo"
- given:
date: '2013-03-29'
regions: ["cl"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2013-03-30'
regions: ["cl"]
options: ["informal"]
expect:
name: "Sábado Santo"
- given:
date: '2014-04-18'
regions: ["cl"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2014-04-19'
regions: ["cl"]
options: ["informal"]
expect:
name: "Sábado Santo"
- given:
date: '2015-04-03'
regions: ["cl"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2015-04-04'
regions: ["cl"]
options: ["informal"]
expect:
name: "Sábado Santo"
- given:
date: '2016-03-25'
regions: ["cl"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2016-03-26'
regions: ["cl"]
options: ["informal"]
expect:
name: "Sábado Santo"
- given:
date: '2014-05-01'
regions: ["cl"]
options: ["informal"]
expect:
name: "Día del Trabajo"
- given:
date: '2014-05-21'
regions: ["cl"]
options: ["informal"]
expect:
name: "Día de las Glorias Navales"
- given:
date: '1999-06-29'
regions: ["cl"]
options: ["informal"]
expect:
name: "San Pedro y San Pablo"
- given:
date: '2000-06-26'
regions: ["cl"]
options: ["informal"]
expect:
name: "San Pedro y San Pablo"
- given:
date: '2017-06-26'
regions: ["cl"]
options: ["informal"]
expect:
name: "San Pedro y San Pablo"
- given:
date: '2018-07-2'
regions: ["cl"]
options: ["informal"]
expect:
name: "San Pedro y San Pablo"
- given:
date: '2014-07-16'
regions: ["cl"]
options: ["informal"]
expect:
name: "Día de la Virgen del Carmen"
- given:
date: '2014-08-15'
regions: ["cl"]
options: ["informal"]
expect:
name: "Asunción de la Virgen"
- given:
date: '2014-09-18'
regions: ["cl"]
options: ["informal"]
expect:
name: "Independencia Nacional"
- given:
date: '2014-09-19'
regions: ["cl"]
options: ["informal"]
expect:
name: "Día de las Glorias del Ejército"
- given:
date: '1999-10-12'
regions: ["cl"]
options: ["informal"]
expect:
name: "Encuentro de Dos Mundos"
- given:
date: '2017-10-9'
regions: ["cl"]
options: ["informal"]
expect:
name: "Encuentro de Dos Mundos"
- given:
date: '2017-10-27'
regions: ["cl"]
options: ["informal"]
expect:
name: "Día de las Iglesias Evangélicas y Protestantes"
- given:
date: '2014-11-01'
regions: ["cl"]
options: ["informal"]
expect:
name: "Día de Todos los Santos"
- given:
date: '2014-12-08'
regions: ["cl"]
options: ["informal"]
expect:
name: "Inmaculada Concepción de María"
- given:
date: '2014-12-25'
regions: ["cl"]
options: ["informal"]
expect:
name: "Navidad"

437
vendor/holidays/definitions/co.yaml vendored Normal file
View File

@ -0,0 +1,437 @@
# Colombian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2018-06-01.
#
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Colombia
# - https://publicholidays.co/
# - https://www.calendariodecolombia.com/
# - https://www.officeholidays.com/countries/colombia/
# - https://www.timeanddate.com/holidays/colombia/
# - http://www.bank-holidays.com/country/Colombia_42.htm
---
methods:
# Movable holiday: when they do not fall on a Monday, these holidays are observed the following Monday.
to_following_monday_if_not_monday:
arguments: date
ruby: |
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
epiphany:
arguments: year
ruby: |
date = Date.civil( year, 1, 6 )
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
saint_josephs_day:
arguments: year
ruby: |
date = Date.civil( year, 3, 19 )
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
saint_peter_and_saint_paul:
arguments: year
ruby: |
date = Date.civil( year, 6, 29 )
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
assumption_of_mary:
arguments: year
ruby: |
date = Date.civil( year, 8, 15 )
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
columbus_day:
arguments: year
ruby: |
date = Date.civil( year, 10, 12 )
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
all_saints_day:
arguments: year
ruby: |
date = Date.civil( year, 11, 1 )
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
independence_of_cartagena:
arguments: year
ruby: |
date = Date.civil( year, 11, 11 )
if date.wday > 1
date += ( 8 - date.wday )
elsif date.wday == 0
date += 1
end
date
months:
0:
- name: Jueves Santo
regions: [co]
function: easter(year)
function_modifier: -3
- name: Viernes Santo
regions: [co]
function: easter(year)
function_modifier: -2
- name: Día de la Ascensión
regions: [co]
function: easter(year)
function_modifier: 43
- name: Corpus Christi
regions: [co]
function: easter(year)
function_modifier: 64
- name: Sagrado Corazón
regions: [co]
function: easter(year)
function_modifier: 71
1:
- name: Año Nuevo
regions: [co]
mday: 1
- name: Día de los Reyes Magos
regions: [co]
function: epiphany(year)
3:
- name: Día de San José
regions: [co]
function: saint_josephs_day(year)
5:
- name: Día del Trabajo
regions: [co]
mday: 1
6:
- name: San Pedro y San Pablo
regions: [co]
function: saint_peter_and_saint_paul(year)
7:
- name: Día de la Independencia
regions: [co]
mday: 20
8:
- name: Batalla de Boyacá
regions: [co]
mday: 7
- name: La Asunción de la Virgen
regions: [co]
function: assumption_of_mary(year)
10:
- name: Día de la Raza
regions: [co]
function: columbus_day(year)
11:
- name: Día de Todos los Santos
regions: [co]
function: all_saints_day(year)
- name: Independencia de Cartagena
regions: [co]
function: independence_of_cartagena(year)
12:
- name: Día de la Inmaculada Concepción
regions: [co]
mday: 8
- name: Navidad
regions: [co]
mday: 25
tests:
# Año Nuevo
- given:
date: '2014-01-01'
regions: ['co']
expect:
name: 'Año Nuevo'
- given:
date: '2017-01-01'
regions: ['co']
expect:
name: 'Año Nuevo'
# Día de los Reyes Magos
- given:
date: '2014-01-06'
regions: ['co']
expect:
name: 'Día de los Reyes Magos'
- given:
date: '2015-01-12'
regions: ['co']
expect:
name: 'Día de los Reyes Magos'
- given:
date: '2017-01-09'
regions: ['co']
expect:
name: 'Día de los Reyes Magos'
# Día de San José
- given:
date: '2014-03-24'
regions: ['co']
expect:
name: 'Día de San José'
- given:
date: '2017-03-20'
regions: ['co']
expect:
name: 'Día de San José'
- given:
date: '2018-03-19'
regions: ['co']
expect:
name: 'Día de San José'
# Jueves Santo
- given:
date: '2015-04-02'
regions: ['co']
expect:
name: 'Jueves Santo'
- given:
date: '2017-04-13'
regions: ['co']
expect:
name: 'Jueves Santo'
- given:
date: '2018-03-29'
regions: ['co']
expect:
name: 'Jueves Santo'
# Viernes Santo
- given:
date: '2014-04-18'
regions: ['co']
expect:
name: 'Viernes Santo'
- given:
date: '2016-03-25'
regions: ['co']
expect:
name: 'Viernes Santo'
- given:
date: '2018-03-30'
regions: ['co']
expect:
name: 'Viernes Santo'
# Día del Trabajo
- given:
date: '2013-05-01'
regions: ['co']
expect:
name: 'Día del Trabajo'
- given:
date: '2016-05-01'
regions: ['co']
expect:
name: 'Día del Trabajo'
# Día de la Ascensión
- given:
date: '2014-06-02'
regions: ['co']
expect:
name: 'Día de la Ascensión'
- given:
date: '2016-05-09'
regions: ['co']
expect:
name: 'Día de la Ascensión'
- given:
date: '2017-05-29'
regions: ['co']
expect:
name: 'Día de la Ascensión'
# Corpus Christi
- given:
date: '2014-06-23'
regions: ['co']
expect:
name: 'Corpus Christi'
- given:
date: '2016-05-30'
regions: ['co']
expect:
name: 'Corpus Christi'
- given:
date: '2017-06-19'
regions: ['co']
expect:
name: 'Corpus Christi'
# Sagrado Corazón
- given:
date: '2014-06-30'
regions: ['co']
expect:
name: 'Sagrado Corazón'
- given:
date: '2016-06-06'
regions: ['co']
expect:
name: 'Sagrado Corazón'
- given:
date: '2017-06-26'
regions: ['co']
expect:
name: 'Sagrado Corazón'
# San Pedro y San Pablo
- given:
date: '2016-07-04'
regions: ['co']
expect:
name: 'San Pedro y San Pablo'
- given:
date: '2017-07-03'
regions: ['co']
expect:
name: 'San Pedro y San Pablo'
# Día de la Independencia
- given:
date: '2014-07-20'
regions: ['co']
expect:
name: 'Día de la Independencia'
- given:
date: '2016-07-20'
regions: ['co']
expect:
name: 'Día de la Independencia'
- given:
date: '2018-07-20'
regions: ['co']
expect:
name: 'Día de la Independencia'
# Batalla de Boyacá
- given:
date: '2014-08-07'
regions: ['co']
expect:
name: 'Batalla de Boyacá'
- given:
date: '2016-08-07'
regions: ['co']
expect:
name: 'Batalla de Boyacá'
- given:
date: '2018-08-07'
regions: ['co']
expect:
name: 'Batalla de Boyacá'
# La Asunción de la Virgen
- given:
date: '2014-08-18'
regions: ['co']
expect:
name: 'La Asunción de la Virgen'
- given:
date: '2016-08-15'
regions: ['co']
expect:
name: 'La Asunción de la Virgen'
- given:
date: '2017-08-21'
regions: ['co']
expect:
name: 'La Asunción de la Virgen'
# Día de la Raza
- given:
date: '2014-10-13'
regions: ['co']
expect:
name: 'Día de la Raza'
- given:
date: '2016-10-17'
regions: ['co']
expect:
name: 'Día de la Raza'
- given:
date: '2017-10-16'
regions: ['co']
expect:
name: 'Día de la Raza'
# Día de Todos los Santos
- given:
date: '2014-11-03'
regions: ['co']
expect:
name: 'Día de Todos los Santos'
- given:
date: '2016-11-07'
regions: ['co']
expect:
name: 'Día de Todos los Santos'
- given:
date: '2017-11-06'
regions: ['co']
expect:
name: 'Día de Todos los Santos'
# Independencia de Cartagena
- given:
date: '2014-11-17'
regions: ['co']
expect:
name: 'Independencia de Cartagena'
- given:
date: '2016-11-14'
regions: ['co']
expect:
name: 'Independencia de Cartagena'
- given:
date: '2017-11-13'
regions: ['co']
expect:
name: 'Independencia de Cartagena'
# Día de la Inmaculada Concepción
- given:
date: '2013-12-08'
regions: ['co']
expect:
name: 'Día de la Inmaculada Concepción'
- given:
date: '2014-12-08'
regions: ['co']
expect:
name: 'Día de la Inmaculada Concepción'
- given:
date: '2016-12-08'
regions: ['co']
expect:
name: 'Día de la Inmaculada Concepción'
# Navidad
- given:
date: '2014-12-25'
regions: ['co']
expect:
name: 'Navidad'
- given:
date: '2016-12-25'
regions: ['co']
expect:
name: 'Navidad'
- given:
date: '2017-12-25'
regions: ['co']
expect:
name: 'Navidad'

100
vendor/holidays/definitions/cr.yaml vendored Normal file
View File

@ -0,0 +1,100 @@
# Costa Rican holiday definitions for the Ruby Holiday gem.
#
#
# Updated: 2014-11-22.
#
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Costa_Rica
#
months:
0:
- name: Jueves Santo
regions: [cr]
function: easter(year)
function_modifier: -3
- name: Viernes Santo
regions: [cr]
function: easter(year)
function_modifier: -2
1:
- name: Año Nuevo
regions: [cr]
mday: 1
4:
- name: Día de Juan Santamaría
regions: [cr]
mday: 11
5:
- name: Día del Trabajador
regions: [cr]
mday: 1
7:
- name: Día de la Anexión de Guanacaste
regions: [cr]
mday: 25
8:
- name: Día de la Virgen de los Angeles
regions: [cr]
mday: 2
- name: Día de la Madre
regions: [cr]
mday: 15
9:
- name: Día de la Independencia
regions: [cr]
mday: 15
10:
- name: Día de las Culturas
regions: [cr]
mday: 12
12:
- name: Navidad
regions: [cr]
mday: 25
tests:
- given:
date: '2015-01-01'
regions: ["cr"]
expect:
name: "Año Nuevo"
- given:
date: '2015-04-11'
regions: ["cr"]
expect:
name: "Día de Juan Santamaría"
- given:
date: '2015-05-01'
regions: ["cr"]
expect:
name: "Día del Trabajador"
- given:
date: '2015-07-25'
regions: ["cr"]
expect:
name: "Día de la Anexión de Guanacaste"
- given:
date: '2015-08-02'
regions: ["cr"]
expect:
name: "Día de la Virgen de los Angeles"
- given:
date: '2015-08-15'
regions: ["cr"]
expect:
name: "Día de la Madre"
- given:
date: '2015-09-15'
regions: ["cr"]
expect:
name: "Día de la Independencia"
- given:
date: '2015-10-12'
regions: ["cr"]
expect:
name: "Día de las Culturas"
- given:
date: '2016-12-25'
regions: ["cr"]
expect:
name: "Navidad"

137
vendor/holidays/definitions/cz.yaml vendored Normal file
View File

@ -0,0 +1,137 @@
# Czech holiday definitions for the Ruby Holiday gem.
#
# Updated: 2016-04-20.
# Sources:
# - http://cs.wikipedia.org/wiki/%C4%8Cesk%C3%BD_st%C3%A1tn%C3%AD_sv%C3%A1tek
# - http://www.mpsv.cz/cs/74
---
months:
0:
- name: Velký pátek
regions: [cz]
function: easter(year)
function_modifier: -2
- name: Velikonoční pondělí
regions: [cz]
function: easter(year)
function_modifier: 1
1:
- name: Den obnovy samostatného českého státu
regions: [cz]
mday: 1
5:
- name: Svátek práce
regions: [cz]
mday: 1
- name: Den vítězství
regions: [cz]
mday: 8
7:
- name: Den slovanských věrozvěstů Cyrila a Metoděje
regions: [cz]
mday: 5
- name: Den upálení mistra Jana Husa
regions: [cz]
mday: 6
9:
- name: Den české státnosti
regions: [cz]
mday: 28
10:
- name: Den vzniku samostatného československého státu
regions: [cz]
mday: 28
11:
- name: Den boje za svobodu a demokracii
regions: [cz]
mday: 17
12:
- name: Štědrý den
regions: [cz]
mday: 24
- name: 1. svátek vánoční
regions: [cz]
mday: 25
- name: 2. svátek vánoční
regions: [cz]
mday: 26
tests:
- given:
date: '2010-01-01'
regions: ["cz"]
options: ["informal"]
expect:
name: "Den obnovy samostatného českého státu"
- given:
date: '2016-03-25'
regions: ["cz"]
options: ["informal"]
expect:
name: "Velký pátek"
- given:
date: '2010-04-05'
regions: ["cz"]
options: ["informal"]
expect:
name: "Velikonoční pondělí"
- given:
date: '2010-05-01'
regions: ["cz"]
options: ["informal"]
expect:
name: "Svátek práce"
- given:
date: '2010-05-08'
regions: ["cz"]
options: ["informal"]
expect:
name: "Den vítězství"
- given:
date: '2010-07-05'
regions: ["cz"]
options: ["informal"]
expect:
name: "Den slovanských věrozvěstů Cyrila a Metoděje"
- given:
date: '2010-07-06'
regions: ["cz"]
options: ["informal"]
expect:
name: "Den upálení mistra Jana Husa"
- given:
date: '2010-09-28'
regions: ["cz"]
options: ["informal"]
expect:
name: "Den české státnosti"
- given:
date: '2010-10-28'
regions: ["cz"]
options: ["informal"]
expect:
name: "Den vzniku samostatného československého státu"
- given:
date: '2010-11-17'
regions: ["cz"]
options: ["informal"]
expect:
name: "Den boje za svobodu a demokracii"
- given:
date: '2010-12-24'
regions: ["cz"]
options: ["informal"]
expect:
name: "Štědrý den"
- given:
date: '2010-12-25'
regions: ["cz"]
options: ["informal"]
expect:
name: "1. svátek vánoční"
- given:
date: '2010-12-26'
regions: ["cz"]
options: ["informal"]
expect:
name: "2. svátek vánoční"

367
vendor/holidays/definitions/de.yaml vendored Normal file
View File

@ -0,0 +1,367 @@
# German holiday definitions for the Ruby Holiday gem.
#
# Updated: 2019-02-10
#
# Changes 2016-11-27:
# - Change de_sn_aux, de_th_aux to de_sn_sorbian (because it only is celebrated in Sorbian regions in Sachsen) and de_th_eichsfeld, to reflect region of Eichsfeld
# - Change de_sn_aux to de_by_augsburg to reflect only City of Augsburg
#
# Changes 2017-06-08:
# - Add Berlin, Bremen, Hamburg, Niedersachsen, Schleswig-Holstein
# - Change de_th_eichsfeld to de_th_cath because it affects the catholic communities Eichsfeld, Unstrut-Hainich-Kreis and Wartburgkreis
# - Merge Fronleichnam entry
# - Add de_by_cath for catholic communities in Bavaria; Maria Himmelfahrt is not a Bavaria-wide holiday
# - Mariä Himmelfahrt is celebrated in the community of Augsburg (de_by_augsburg)
# - Enhance tests
#
# Changes 2017-09-25:
# - Correct definition for Reformation Day
#
# Changes 2018-09-10:
# - Reformation Day has been added as a new holiday in Bremen, Hamburg, Lower Saxony and Schleswig-Holstein, starting in 2018.
#
# Change 2019-02-10:
# - Changing usage of 'year_ranges.after' to 'year_ranges.from', see https://github.com/holidays/definitions/issues/117
#
# Sources:
# - http://en.wikipedia.org/wiki/Holidays_in_Germany
# - http://www.timeanddate.com/calendar/index.html?country=8
# - http://www.germany.info/relaunch/welcome/travel/holidays.html
# - https://www.statistik.bayern.de/statistik/bevoelkerungsstand/00141.php
# - http://www.thueringen.de/mam/th3/tim/verwaltungsrecht/fronleichnam_gemeindeschluesselzahlen.pdf
---
months:
0:
- name: Karfreitag
regions: [de]
function: easter(year)
function_modifier: -2
- name: Ostersonntag
regions: [de]
function: easter(year)
type: informal
- name: Ostermontag
regions: [de]
function: easter(year)
function_modifier: 1
- name: Christi Himmelfahrt
regions: [de]
function: easter(year)
function_modifier: 39
- name: Pfingstsonntag
regions: [de]
function: easter(year)
function_modifier: 49
type: informal
- name: Pfingstmontag
regions: [de]
function: easter(year)
function_modifier: 50
- name: Fronleichnam
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn_sorbian, de_th_cath]
function: easter(year)
function_modifier: 60
- name: Weiberfastnacht
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn]
function: easter(year)
function_modifier: -52
type: informal
- name: Rosenmontag
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn]
function: easter(year)
function_modifier: -48
type: informal
- name: Aschermittwoch
regions: [de_bw, de_by, de_he, de_nw, de_rp, de_sl, de_sn]
function: easter(year)
function_modifier: -46
type: informal
1:
- name: Neujahrstag
regions: [de]
mday: 1
- name: Heilige Drei Könige
regions: [de_bw, de_by, de_st]
mday: 6
3:
- name: Internationaler Frauentag
regions: [de_be]
mday: 8
year_ranges:
from: 2019
5:
- name: Tag der Arbeit
regions: [de]
mday: 1
- name: Tag der Befreiung
regions: [de_be]
mday: 8
year_ranges:
limited: [2020]
8:
- name: Mariä Himmelfahrt
regions: [de_by_cath, de_by_augsburg, de_sl]
mday: 15
- name: Friedensfest
regions: [de_by_augsburg]
mday: 8
10:
- name: Tag der Deutschen Einheit
regions: [de]
mday: 3
- name: Reformationstag
regions: [de_bb, de_mv, de_sn, de_st, de_th]
mday: 31
- name: Reformationstag
regions: [de_bw]
mday: 31
type: informal
- name: Reformationstag
regions: [de]
mday: 31
year_ranges:
limited: [2017]
- name: Reformationstag
regions: [de_hb, de_hh, de_ni, de_sh]
mday: 31
year_ranges:
from: 2018
11:
- name: Allerheiligen
regions: [de_bw, de_by, de_nw, de_rp, de_sl]
mday: 1
- name: Buß- und Bettag
regions: [de_sn]
function: de_buss_und_bettag(year)
12:
- name: Heilig Abend
regions: [de]
mday: 24
type: informal
- name: 1. Weihnachtstag
regions: [de]
mday: 25
- name: 2. Weihnachtstag
regions: [de]
mday: 26
- name: Silvester
regions: [de]
mday: 31
type: informal
methods:
de_buss_und_bettag:
# Germany: Wednesday before November 23
arguments: year
ruby: |
date = Date.civil(year,11,23)
if date.wday > 3
date -= (date.wday - 3)
else
date -= (date.wday + 4)
end
date
tests:
- given:
date: '2009-01-01'
regions: ["de"]
options: ["informal"]
expect:
name: "Neujahrstag"
- given:
date: '2009-04-10'
regions: ["de"]
options: ["informal"]
expect:
name: "Karfreitag"
- given:
date: '2009-04-12'
regions: ["de"]
options: ["informal"]
expect:
name: "Ostersonntag"
- given:
date: '2009-04-13'
regions: ["de"]
options: ["informal"]
expect:
name: "Ostermontag"
- given:
date: '2009-05-01'
regions: ["de"]
options: ["informal"]
expect:
name: "Tag der Arbeit"
- given:
date: '2009-05-21'
regions: ["de"]
options: ["informal"]
expect:
name: "Christi Himmelfahrt"
- given:
date: '2009-05-31'
regions: ["de"]
options: ["informal"]
expect:
name: "Pfingstsonntag"
- given:
date: '2009-06-01'
regions: ["de"]
options: ["informal"]
expect:
name: "Pfingstmontag"
- given:
date: '2009-10-03'
regions: ["de"]
options: ["informal"]
expect:
name: "Tag der Deutschen Einheit"
- given:
date: '2009-12-24'
regions: ["de"]
options: ["informal"]
expect:
name: "Heilig Abend"
- given:
date: '2009-12-25'
regions: ["de"]
options: ["informal"]
expect:
name: "1. Weihnachtstag"
- given:
date: '2009-12-26'
regions: ["de"]
options: ["informal"]
expect:
name: "2. Weihnachtstag"
- given:
date: '2009-12-31'
regions: ["de"]
options: ["informal"]
expect:
name: "Silvester"
- given:
date: '2009-01-06'
regions: ["de_bw", "de_by", "de_st", "de_"]
expect:
name: "Heilige Drei Könige"
- given:
date: '2009-06-11'
regions: ["de_bw", "de_by", "de_he", "de_nw", "de_rp", "de_sl", "de_sn_sorbian", "de_th_cath"]
expect:
name: "Fronleichnam"
- given:
date: '2009-08-15'
regions: ["de_by", "de_sl", "de_"]
expect:
name: "Mariä Himmelfahrt"
- given:
date: '2009-10-31'
regions: ["de_bb", "de_mv", "de_sn", "de_st", "de_th", "de_"]
expect:
name: "Reformationstag"
- given:
date: '2009-10-31'
regions: ["de_bw"]
options: ["informal"]
expect:
name: "Reformationstag"
- given:
date: '2017-10-31'
regions: ["de"]
expect:
name: "Reformationstag"
- given:
date: '2016-10-31'
regions: ["de"]
expect:
holiday: false
- given:
date: '2018-10-31'
regions: ["de"]
expect:
holiday: false
- given:
date: '2018-10-31'
regions: ["de_bb", "de_hb", "de_hh", "de_mv", "de_ni", "de_sh", "de_sn", "de_st", "de_th"]
expect:
name: "Reformationstag"
- given:
date: '2009-11-01'
regions: ["de_bw", "de_by", "de_nw", "de_rp", "de_sl", "de_"]
expect:
name: "Allerheiligen"
- given:
date: '2015-08-08'
regions: ["de_by_augsburg"]
expect:
name: "Friedensfest"
- given:
date: '2015-08-08'
regions: ["de", "de_bw", "de_by", "de_bb", "de_he", "de_mv", "de_nw", "de_rp", "de_sl", "de_sn", "de_st", "de_th"]
expect:
holiday: false
- given:
date: '2010-05-08'
regions: ["de"]
expect:
holiday: false
- given:
date: '2010-08-08'
regions: ["de"]
expect:
holiday: false
- given:
date: '2004-11-17'
regions: ["de_sn"]
expect:
name: "Buß- und Bettag"
- given:
date: '2005-11-16'
regions: ["de_sn"]
expect:
name: "Buß- und Bettag"
- given:
date: '2006-11-22'
regions: ["de_sn"]
expect:
name: "Buß- und Bettag"
- given:
date: '2009-11-18'
regions: ["de_sn"]
expect:
name: "Buß- und Bettag"
- given:
date: '2016-02-04'
regions: ["de_bw", "de_by", "de_he", "de_nw", "de_rp", "de_sl", "de_sn"]
options: ["informal"]
expect:
name: "Weiberfastnacht"
- given:
date: '2016-02-08'
regions: ["de_bw", "de_by", "de_he", "de_nw", "de_rp", "de_sl", "de_sn"]
options: ["informal"]
expect:
name: "Rosenmontag"
- given:
date: '2016-02-10'
regions: ["de_bw", "de_by", "de_he", "de_nw", "de_rp", "de_sl", "de_sn"]
options: ["informal"]
expect:
name: "Aschermittwoch"
- given:
date: '2018-03-08'
regions: ["de_be"]
expect:
holiday: false
- given:
date: '2019-03-08'
regions: ["de_be"]
expect:
name: "Internationaler Frauentag"
- given:
date: '2020-05-08'
regions: ["de_be"]
expect:
name: "Tag der Befreiung"

208
vendor/holidays/definitions/dk.yaml vendored Normal file
View File

@ -0,0 +1,208 @@
# Danish holiday definitions for the Ruby Holiday gem.
#
# Updated: 2008-11-22.
# Sources:
# - http://en.wikipedia.org/wiki/Holidays_in_Denmark
# - http://www.amblondon.um.dk/en/menu/AboutDenmark/PublicHolidaysInDK/PublicHolidaysinDenmark-until2010.htm
# - http://borger.dk/forside/kirke-og-tro/folkekirken/officielle-helligdage
---
months:
0:
- name: Fastelavn
regions: [dk]
function: easter(year)
function_modifier: -49
type: informal
- name: Palmesøndag
regions: [dk]
function: easter(year)
function_modifier: -7
type: informal
- name: Skærtorsdag
regions: [dk]
function: easter(year)
function_modifier: -3
- name: Langfredag
regions: [dk]
function: easter(year)
function_modifier: -2
- name: Påskedag
regions: [dk]
function: easter(year)
- name: 2. påskedag
regions: [dk]
function: easter(year)
function_modifier: 1
- name: Store Bededag
regions: [dk]
function: easter(year)
function_modifier: 26
- name: Kristi Himmelfartsdag
regions: [dk]
function: easter(year)
function_modifier: 39
- name: Pinsedag
regions: [dk]
function: easter(year)
function_modifier: 49
- name: 2. Pinsedag
regions: [dk]
function: easter(year)
function_modifier: 50
1:
- name: Nytårsdag
regions: [dk]
mday: 1
4:
- name: 1. april
regions: [dk]
mday: 1
type: informal
- name: Danmarks besættelse
regions: [dk]
mday: 9
type: informal
- name: Dronningens fødselsdag
regions: [dk]
mday: 16
type: informal
5:
- name: Arbejdernes kampdag
regions: [dk]
mday: 1
type: informal
- name: Danmarks befrielse
regions: [dk]
mday: 5
type: informal
6:
- name: Grundlovsdag
regions: [dk]
mday: 5
type: informal
- name: Valdemarsdag og Genforeningsdag
regions: [dk]
mday: 15
type: informal
- name: Sankt Hans aften
regions: [dk]
mday: 23
type: informal
11:
- name: Mortensaften
regions: [dk]
mday: 10
type: informal
12:
- name: Sankt Lucia
regions: [dk]
mday: 13
type: informal
- name: Juleaftensdag
regions: [dk]
mday: 24
type: informal
- name: 1. juledag
regions: [dk]
mday: 25
- name: 2. juledag
regions: [dk]
mday: 26
tests:
- given:
date: '2007-01-01'
regions: ["dk"]
options: ["informal"]
expect:
name: "Nytårsdag"
- given:
date: '2007-02-18'
regions: ["dk"]
options: ["informal"]
expect:
name: "Fastelavn"
- given:
date: '2007-04-09'
regions: ["dk"]
options: ["informal"]
expect:
name: "2. påskedag"
- given:
date: '2007-04-16'
regions: ["dk"]
options: ["informal"]
expect:
name: "Dronningens fødselsdag"
- given:
date: '2007-04-05'
regions: ["dk"]
options: ["informal"]
expect:
name: "Skærtorsdag"
- given:
date: '2007-04-06'
regions: ["dk"]
options: ["informal"]
expect:
name: "Langfredag"
- given:
date: '2007-04-08'
regions: ["dk"]
options: ["informal"]
expect:
name: "Påskedag"
- given:
date: '2007-05-01'
regions: ["dk"]
options: ["informal"]
expect:
name: "Arbejdernes kampdag"
- given:
date: '2007-05-04'
regions: ["dk"]
options: ["informal"]
expect:
name: "Store Bededag"
- given:
date: '2007-05-17'
regions: ["dk"]
options: ["informal"]
expect:
name: "Kristi Himmelfartsdag"
- given:
date: '2007-05-27'
regions: ["dk"]
options: ["informal"]
expect:
name: "Pinsedag"
- given:
date: '2007-05-28'
regions: ["dk"]
options: ["informal"]
expect:
name: "2. Pinsedag"
- given:
date: '2007-06-05'
regions: ["dk"]
options: ["informal"]
expect:
name: "Grundlovsdag"
- given:
date: '2007-12-24'
regions: ["dk"]
options: ["informal"]
expect:
name: "Juleaftensdag"
- given:
date: '2007-12-25'
regions: ["dk"]
options: ["informal"]
expect:
name: "1. juledag"
- given:
date: '2007-12-26'
regions: ["dk"]
options: ["informal"]
expect:
name: "2. juledag"

View File

@ -0,0 +1,34 @@
# How to contribute
In this repository we have all of the definitions that are used in holiday calcuations. We rely on users around the world to help keep our definitions accurate and up to date.
## Code of Conduct
Please read our [Code of Conduct](https://github.com/holidays/holidays/blob/master/CODE_OF_CONDUCT.md) before contributing. Everyone interacting with this project (or associated projects) is expected to abide by its terms.
## Definition Updates
Our definitions are written in YAML. You can find a complete guide to our format in the [syntax docs](SYNTAX.md). We take the YAML definitions and generate final definition files in the various projects that are loaded at runtime for fast calculations.
Here are the steps to take once you have a good idea on what you want to change:
* Fork this repository
* Edit desired definition YAML file(s). If you are adding a new region be sure to update `index.yaml` as well
* Run `make validate` to ensure that all updates match our definition format
* Open a PR with your changes
Including documentation with your updates is very much appreciated. A simple Wikipedia entry or government link in the comments alongside your changes would be perfect.
Lastly, note that there are many 'meta' regions. For example, there are regions for Europe, Scandinavia, and North America. If your new region(s) falls into these areas consider adding them. You can find these 'meta' regions in `definitions/index.yaml`.
Don't worry about versioning, we'll handle it on our end.
*Tests are required for new definitions*.
## Definition Validation
We maintain a `make validate` command to ensure that all YAML definitions match our internal specifications. This is to make working with this repository as independent as possible from the other repositories (like the existing ruby repository). If `make validate` passes then we ensure that anything consuming these files will receive 'correct' formats.
If you run into any weird `make validate` errors please open an issue or PR and highlight to what you are seeing. The validation code is brand-new and might have issues. Maintainers will respond quickly to any open problems.
If you would like to add to, update, or otherwise fix any of our specs then please fork and submit a PR like you would any other change. Please note that we require 100% test coverage. Your builds will not pass if you fall below 100%.

View File

@ -0,0 +1,39 @@
# Maintainers guide
This document outlines the process of releasing an update of the definitions in this repository. Please note
that this document does NOT try to explain how to create packages for various languages. It is *just*
for creating version snapshots of definition files.
To be as clear as possible: this repository is *just* for definition updates. We 'release' updates as tags in Github
but do not push any code updates. Downstream projects (like ruby) will consume this and make their own appropriate releases.
The 'releases' in this project are mainly for organizational purposes.
### Who this document is for
This document is for maintainers that have merge access to this repository. Generally these people will also have access to any
language-specific libraries and so this will be a part of the entire release process. Usually other libraries (like the ruby library)
will reference this document as part of its own release process.
Please note that a core contributor must provide the relevant Github access so that you can perform merges. If you have any issues
please contact the [core members](https://github.com/orgs/holidays/teams/core/members) for assistance.
### Setup
This guide assumes that you have forked the repository in Github. If you require assistance in this please contact the core members listed above.
### Merging new definition changes
When new PRs are submitted you can navigate the following steps:
* Make sure that the PR Travis CI builds are green. If they are green then you can simply continue. If there are errors you
will need to investigate further (contact a core member for assistance).
* If the builds are green and the changes look reasonable to you then go ahead and merge!
* Once the merges are done, make a new branch on your fork that includes an updated [CHANGELOG](https://github.com/holidays/definitions/blob/master/CHANGELOG.md)
that has the new version and associated changes. This is pretty open-ended! Include the information that you feel is
important. Use past CHANGELOG updates as a guide.
* Open a PR against the CHANGELOG branch and merge it (this may require another maintainer for safety)
* Once the updated CHANGELOG is merged, go to [releases](https://github.com/holidays/definitions/releases) and create a new release. It should point at the latest commit that contains the changes that you want included in this release. If you just merged then you can just point at master. All release versions follow this format: `vMAJOR.MINOR.PATCH`. This should follow normal [semver rules](https://semver.org/).
You don't need to list out the specific changes that were made on the release description. You can just give a general overview and then link to the updated CHANGELOG that you did in a previous step. Example: [v2.2.0](https://github.com/holidays/definitions/releases/tag/v2.2.0)
Once the release is created in Github you are done! The definitions have been 'released' and downstream projects (right now just ruby) can reference them without issues. See the maintainers guides in downstream projects for information on how to release updates for each language.

View File

@ -0,0 +1,435 @@
# Holiday Definition Syntax
The definition syntax is a custom format developed over the life of this project. All holidays are defined in these YAML files. These definition files have three main top-level properties:
* `months` - this is the meat! All definitions for months 1-12 are defined here
* `methods` - this contains any custom logic that your definitions require
* `tests` - this contains the tests for your definitions
The `months` property is required. The two other properties are not strictly required but are almost always used.
In fact, if you leave out `tests` your PR will probably not be accepted unless there is a very, very good reason for leaving it out.
## Key Words
There are some terms that you should be familiar with before we dive into each section:
#### `region`
A region is a symbol that denotes the geographic or cultural region for that holiday. In general these symbols will be the [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166) code for a country or region.
##### Sub-region
We also have a concept of a `sub-region`. These regions exist inside of a 'parent' region and inherit the parent's holidays. We use an underscore to specify a subregion.
Examples:
* `:us_dc` for Washington, D.C in `:us`
* `:ca_bc` for British Columbia in `:ca`
Some sub-regions do not have a matching ISO 3116 entry. In these cases we attempt to choose symbols that are reasonably clear.
##### Non-standard regions
Before version v1.1.0 of the original ruby gem the compliance with ISO 3166 was not as strict. There might be cases where an existing region symbol does not match the ISO standard.
Non-standard regions (e.g. `ecbtarget`, `federalreserve`, etc) must be all one word, just like a normal region. They must not use underscores or hyphens.
#### `formal`/`informal`
We consider `formal` dates as government-defined holidays. These could be the kinds of holidays where everyone stays home from work or perhaps are bank holidays but it is *not required* for a holiday to have these features to be considered formal.
`Informal` holidays are holidays that everyone knows about but aren't enshrined in law. For example, Valentine's Day in the US is considered an informal holiday.
We recognize that these definitions can be highly subjective. If you disagree with the current status of a holiday please open an issue so we can discuss it.
#### `observed`
There are certain holidays that can be legally observed on different days than they occur. For example, if a holiday falls on a Saturday but it is legally observed on the following Monday then you can define it as `observed` on the Monday. Please see the section below for more details and examples.
## Months
Holidays are grouped by month from 1 through 12. Each entry within a month can have several properties depending on the behavior of the holiday. Each section below lays out the various different ways you can define your holiday.
The two required properties are:
* `name` - The name of the holiday
* `regions` - One or more region codes (targeted to match [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166))
### Dates defined by a fixed date (e.g. January 1st)
* `mday` - A non-negative integer representing day of the month (1 through 31).
For example, the following holiday is on the first of January and available in the `:ca`, `:us` and `:au` regions:
```yaml
1:
- name: New Year's Day
regions: [ca, us, au]
mday: 1
```
### Dates defined by a week number (e.g. first Monday of a month)
* `wday` - A non-negative integer representing day of the week (0 = Sunday through 6 = Saturday).
* `week` - A non-negative integer representing week number (1 = first week, 3 = third week, -1 = last week),
For example, the following holiday is on the first Monday of September and available in the `:ca` region:
```yaml
9:
- name: Labour Day
regions: [ca]
week: 1
wday: 1
```
### 'Formal' vs 'Informal' types
As mentioned above you can specify two different types. By default a holiday is considered 'formal'. By adding a `type: informal` to a definition you will mark it as 'informal' and it will only show up if the user specifically asks for it.
Example:
```yaml
9:
- name: Some Holiday
regions: [fr]
mday: 1
type: informal
```
If a user submits:
```ruby
Holidays.on(Date.civil(2016, 9, 1), :fr)
```
Then they will not see the holiday. However, if they submit:
```ruby
Holidays.on(Date.civil(2016, 9, 1), :fr, :informal)
```
Then the holiday will be returned. This is especially useful for holidays like "Valentine's Day" in the USA, where it is commonly recognized as a holiday in society but not as a day that is celebrated by taking the day off.
### Year ranges
Certain holidays in various countries are only in effect during specific year ranges. A few examples of this are:
* A new holiday that starts in 2017 and continues into the future
* An existing holiday that has been cancelled so that the final year in effect is 2019
* A historical holiday that was only in effect from 2002 through 2006
To address these kinds of scenarios we have the ability to specify 'year ranges' for individual holiday definitions. There are a total of four selectors that can be specified. All must be specified in terms of 'years'. Only one selector can be used at a time.
#### `until`
The 'until' selector will only return a match if the supplied date takes place in the same year as the holiday or earlier.
A single integer representing a year *must* be supplied. An array of values will result in an error.
Example:
```yaml
7:
name: 振替休日
regions: [jp]
mday: 1
year_ranges:
until: 2002
```
This will return successfully since the date is before 2002:
```ruby
Holidays.on(Date.civil(2000, 7, 1), :jp)
```
This will also return successfully since the date takes place on 2002 exactly:
```ruby
Holidays.on(Date.civil(2002, 7, 1), :jp)
```
This will not since the date is after 2002:
```ruby
Holidays.on(Date.civil(2016, 7, 1), :jp)
```
#### `from`
The 'from' selector will only return a match if the supplied date takes place in the same year as the holiday or later.
A single integer representing a year *must* be supplied. An array of values will result in an error.
Example:
```yaml
7:
name: 振替休日
regions: [jp]
mday: 1
year_ranges:
from: 2002
```
This will return successfully since the date is after 2002:
```ruby
Holidays.on(Date.civil(2016, 7, 1), :jp)
```
This will also return successfully since the date takes place on 2002 exactly:
```ruby
Holidays.on(Date.civil(2002, 7, 1), :jp)
```
This will not since the date is before 2002:
```ruby
Holidays.on(Date.civil(2000, 7, 1), :jp)
```
#### `limited`
The 'limited' selector will only find a match if the supplied date takes place during
one of the specified years. Multiple years can be specified.
An array of integers representing years *must* be supplied. Providing anything other than an array of integers will result in an error.
Please note that this is *not* a range! This is an array of specific years during which the holiday is active. If you need a year range please see the `between` selector below.
Example:
```yaml
7:
name: 振替休日
regions: [jp]
mday: 1
year_ranges:
limited: [2002,2004]
```
Both of these examples will return successfully since the dates takes place in 2002 and 2004 exactly:
```ruby
Holidays.on(Date.civil(2002, 7, 1), :jp)
Holidays.on(Date.civil(2004, 7, 1), :jp)
```
Neither of these will return since the dates takes place in outside of 2002 and 2004:
```ruby
Holidays.on(Date.civil(2000, 7, 1), :jp)
Holidays.on(Date.civil(2003, 7, 1), :jp)
```
#### `between`
The 'between' selector will only find a match if the supplied date takes place during the specified _inclusive_ range of years.
To use this selector you *must* provide both a `start` and `end` key. Both values must be integers representing years.
Example:
```yaml
7:
name: 振替休日
regions: [jp]
mday: 1
year_ranges:
between:
start: 1996
end: 2002
```
These examples will return successfully since they take place within the specified range:
```ruby
Holidays.on(Date.civil(1996, 7, 1), :jp)
Holidays.on(Date.civil(2000, 7, 1), :jp)
Holidays.on(Date.civil(2002, 7, 1), :jp)
```
These will not since both are outside of the specified start/end range:
```ruby
Holidays.on(Date.civil(2003, 7, 1), :jp)
Holidays.on(Date.civil(1995, 7, 1), :jp)
```
## Methods
Sometimes you need to perform a complex calculation to determine a holiday. To facilitate this we allow for users to specify custom methods to calculate a date. These should be placed under the `methods` property. Methods named in this way can then be referenced by entries in the `months` property.
#### Important note
One thing to note is that these methods are _language specific_ at this time, meaning we would have one for ruby, one for golang, etc. Coming up with a standardized way to represent the logic in the custom-written methods proved to be very difficult. This is a punt until we can come up with a better solution.
Please feel free to only add the custom method source in the language that you choose. It will be up to downstream maintainers to ensure that their language has an implementation. So if you only want to add it in ruby please just do that!
### Method Example
Canada celebrates Victoria Day, which falls on the Monday on or before May 24. Under the `methods` property we would create a custom method for ruby that returns a Date object:
```yaml
methods:
ca_victoria_day:
arguments: year
ruby: |
date = Date.civil(year, 5, 24)
if date.wday > 1
date -= (date.wday - 1)
elsif date.wday == 0
date -= 6
end
date
```
This could then be used in a `months` entry:
```yaml
5:
- name: Victoria Day
regions: [ca]
function: ca_victoria_day(year)
```
### Available arguments
You may only specify the following values for arguments into a custom method: `date`, `year`, `month`, `day`, `region`
Correct example:
```yaml
1:
- name: Custom Method
regions: [us]
function: custom_method(year, month, day)
```
The following will return an error since `week` is not a recognized argument:
```yaml
1:
- name: Custom Method
regions: [us]
function: custom_method(week)
```
#### Whaa? Why do you restrict what I can pass in?
This was done as an attempt to make it easier for the downstream projects to parse and use the custom methods. They have to be able to pass in the required data so we limit it to make that process easier.
We can add to this list if your custom logic needs something else! Open an issue with your use case and we can discuss it.
### Methods without a fixed month
If a holiday does not have a fixed month (e.g. Easter) it should go in the '0' month:
```yaml
0:
- name: Easter Monday
regions: [ca]
function: easter(year)
```
### Pre-existing methods
There are pre-existing methods for highly-used calculations. You can reference these methods in your definitions as you would a custom method that you have written:
* `easter(year)` - calculates Easter via Gregorian calendar for a given year
* `orthodox_easter(year)` - calculates Easter via Julian calendar for a given year
* `to_monday_if_sunday(date)` - returns date of the following Monday if the 'date' argument falls on a Sunday
* `to_monday_if_weekend(date)` - returns date of the following Monday if the 'date' argument falls on a weekend (Saturday or Sunday)
* `to_weekday_if_boxing_weekend(date)` - returns nearest following weekday if the 'date' argument falls on Boxing Day
* `to_weekday_if_boxing_weekend_from_year(year)` - calculates nearest weekday following Boxing weekend for given year
* `to_weekday_if_weekend(date)` - returns nearest weekday (Monday or Friday) if 'date' argument falls on a weekend (Saturday or Sunday)
*Protip*: you can use the `easter` methods to calculate all of the dates that are based around Easter. It's especially useful to use since the Easter calculation is complex. For example, 'Good Friday' in the US is 2 days before Easter. Therefore you could do the following:
```
0:
- name: Good Friday
regions: [us]
function: easter(year)
function_modifier: -2
type: informal
```
Use the `function_modifier` property, which can be positive or negative, to modify the result of the function.
### Calculating observed dates
Users can specify that this gem only return holidays on their 'observed' day. This can be especially useful if they are using this gem for business-related logic. If you wish for your definitions to allow for this then you can add the `observed` property to your entry. This requires a method to help calculate the observed day.
Several built-in methods are available for holidays that are observed on varying dates.
For example, for a holiday that is observed on Monday if it falls on a weekend you could write:
```
7:
- name: Canada Day
regions: [ca]
mday: 1
observed: to_monday_if_weekend(date)
```
If a user does not specify `observed` in the options then 7/1 will be the date found for 'Canada Day', regardless of whether it falls on a Saturday or Sunday. If a user specifies 'observed' then it will show as the following Monday if the date falls on a Saturday or Sunday.
## Tests
All definition files should have tests included. At this time we do not enforce any rules on coverage or numbers of tests. However, in general, PRs will not be accepted if they are devoid of tests that cover the changes in question.
The format is a straightforward 'given/expect'. Here is a simple example:
```yaml
- given:
date: '2018-1-1'
regions: ["ex"]
expect:
name: "Example Holiday"
```
Here are format details:
* given (required)
* date (required) - all dates must be in 'YYYY-MM-DD' format. Either a single day or an array of dates can be used.
* regions (required) - an array of strings (NOT symbols). Multiple regions can be passed. Even a single region must be in an array.
* options (optional) - an array of options to use for this test. Can be either 'informal' or 'observed'. Must be an array of strings, e.g. `['informal', 'observed']`
* expect (required)
* name (optional) - the name of the holiday you are expecting. Must be a string.
* holiday (optional) - a boolean indicating whether the given values result in a holiday. Defaults to 'true' if not present. Must be true or false.
One or the other of the `expect` keys is required. If you do not specify a `name` then you should set `holiday: false`.
#### Test Examples
First example shows multiple dates, multiple regions, additional options, and an expectation that the result will be the named holiday:
```yaml
- given:
date: ['2018-1-1', '2019-3-5']
regions: ["ex", "ex2", "ex3"]
options: ["informal"]
expect:
name: "Example Holiday"
```
Second example shows multiple dates, a single region, multiple options, and an expectation that the given values will *not* result in a found holiday. No name is required because...no holiday is expected to be found.
```yaml
- given:
date: ['2022-12-1', '2019-4-1', '2046-8-8]
regions: ["ex"]
options: ["informal", "observed"]
expect:
holiday: false
```
These tests will be picked up by the `generate` process in the client repositories and written into actual tests in the given language that are run when a user executes the test suite.
Please please please include tests. Your PR won't be accepted if tests are not included with your changes.

View File

@ -0,0 +1,15 @@
# Architecture Decision Records
Here we document decisions we made regarding high level architecture/design of this repository.
For details on what ADR is and why it's important, please reference the following blog posts:
- https://product.reverb.com/documenting-architecture-decisions-the-reverb-way-a3563bb24bd0
- http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions
Please note that we only began keeping ADRs for this project in October of 2018. Decisions made before that are not covered.
## Table of contents
1. [Language specific custom methods](adr-001.md)
1. [Year ranges syntax update](adr-002.md)

View File

@ -0,0 +1,86 @@
# ADR 1: Custom Methods Format Change
## Context
We would like these definitions to be usable by any language. The original `holidays` project was written purely in `ruby` but the definitions were generally plain `YAML`.
The issue is that `ruby` has been sprinkled into the otherwise plain `YAML` when it made sense with no plan for use outside of `ruby`. This makes sense when you are never planning on using the `YAML` files in other languages.
Over time we have [been working](https://github.com/holidays/definitions/issues/7) to make the syntax more generic so that other language implementations could consume them. The last hurdle was custom methods.
An example of the original format:
```yaml
methods:
ca_victoria_day:
arguments: year
source: |
date = Date.civil(year, 5, 24)
if date.wday > 1
date -= (date.wday - 1)
elsif date.wday == 0
date -= 6
end
date
```
As you can see the actual function is just plain `ruby`.
After lots of trial and error I have decided that I cannot see a generic format for this logic that would satisfy all use cases for existing custom methods in our definitions. While some custom methods are relatively simple `if/else` statements there are many that are much more complicated.
An example of a 'complicated' custom method from the `ch` (Swiss) region:
```yaml
ch_vd_lundi_du_jeune_federal:
# Monday after the third Sunday of September
arguments: year
ruby: |
date = Date.civil(year,9,1)
# Find the first Sunday of September
until date.wday.eql? 0 do
date += 1
end
# There are 15 days between the first Sunday
# and the Monday after the third Sunday
date + 15
```
The logic itself is not hard to follow but coming up with a generic way to phrase this seems like a complex problem. Every attempt that was made devolved into very complex parsers of nested `YAML` so that we correctly handled each new edge case that appeared. It was very slow going and the complexity was growing and growing.
Additionally, having a complex `YAML` syntax for custom methods would require each downstream repository to implement the 'standard'. That seems pretty scary to think about maintaining.
The other option is to just make each future language provide their own implementations.
## Decision
The decision is to simply require language-specific implementations of custom methods. Since all custom methods are currently in `ruby` we are changing every `source` field to `ruby`. In the future new languages will need to provide their own implementations. For example, we could add a `golang` or `swift` section next to the existing `ruby` section.
There are three significant advantages:
- It is very easy to understand
- All holidays using custom methods have tests so each downstream project will have built-in protection in case a bug is introduced in only one language implementation
- It is very easy to implement for the current `ruby` implementation (which is our only project currently)
There are significant downsides:
- Possible divergence between languages due to separate implementations, causing confusion and frustration
- More pressure on maintainers to handle the various implementations, ensuring they can build without issues when new custom methods are added
- Confusion for new contributors who may only be comfortable in a single language
- New downstream languages will have a higher hurdle to overcome since they will need to implement the existing logic in their own language
In the end I don't want to hold things up because of _possible_ new language implementations that might show up in the future. I personally want to create a new `golang` version of `holidays` but beyond that maybe no one else will consume these definitions!
If the `holidays` projects become wildly popular in the future and this becomes a huge problem then I can address it with the (presumably huge) community to find a solution.
## Consequences
We might lose contributions due to confusion or fear.
We might burn out maintainers if the juggling of languages becomes too much of a burden.
This puts more pressure for the completion of an updated [test framework](https://github.com/holidays/definitions/issues/42) for downstream repositories.
## Status
Accepted.

View File

@ -0,0 +1,64 @@
# ADR 2: Year ranges syntax update
## Context
#### Original year range behavior
Starting in [v3.2.0](https://github.com/holidays/holidays/releases/tag/v3.2.0) of the ruby gem [\[1\]](#footnote-1) we have had the ability to specify year ranges for specific holidays. This allows for a holiday
to only be considered 'valid' or 'active' based on specific criteria surrounding years. The available criteria were:
* `before` - holiday only valid if it takes place on the target year or before
* `after` - holiday only valid if it takes place on the target year or after
* `limited` - holiday only valid if it takes place on at least one of an array of target years (e.g. [2002, 2004])
* `between` - holiday only valid if it takes place between an inclusive year range (e.g. 2002..2004)
This change added useful functionality and its use has since spread to multiple regions.
#### Confusion about criteria behavior
On January 24th, 2019 [an issue was opened](https://github.com/holidays/definitions/issues/117) expressing that the `before` and `after` criteria were named in a confusing manner since it was not clear whether they operated inclusively or exclusively on the target year.
As an example, the value `after: 2018` could be construed by some to mean the holiday is valid starting in 2019 and onward. In reality the current implementation is that the holiday is valid starting in 2018 itself and onward.
While this is ultimately up to individual perception it is true that the current names do not provide strong guidance on how the definition will behave.
## Decision
The [above issue](https://github.com/holidays/definitions/issues/117) also contained a proposal to make the following changes:
* Rename `before` to `until`
* Rename `after` to `from`
These names give a clearer understanding of the desired behavior as `until` and `from` are more generally understood to indicate inclusivity rather than exclusivity.
If we take the example from above and make the change then the value `from: 2018` would intend for the holiday to be valid/active starting in 2018 and onward.
#### Additional changes
While looking into the above issue I noticed two important things that will also be addressed alongside the above changes:
* The definition validator does not currently prevent users from specifying multiple selectors at a time for a `year_ranges` entry and we perform no validation that these selectors do not conflict with one another.
* The `between` key currently accepts a string representation of a Ruby range (e.g. '2008..2012'). While this was not causing any issues today we would like to remove all Ruby-specific values from our definitions so that other languages could more easily parse them.
To that end the following changes will also be made:
* Update the definition validation to only allow a single selector per `year_ranges` entry and update all definitions to match. This will result no behavior changes but will make clear the expected behavior.
* `between` will no longer accept a ruby-like range string but instead require explicit `start` and `end` keys with integer values representing a year.
## Consequences
This change will require changing multiple files and wll result in a major semantic version bump for the definitions. In addition we will also need to make a similar breaking change in all consuming apps.
There are mitigating factors, however. There are only a handful of existing definitions that use the `before`, `after`, or `between` keys and the only consuming app is the [ruby gem](https://github.com/holidays/holidays). This means our affected code is relatively small.
Additionally there was already a plan in place to perform an unrelated breaking change in the gem. This means that we can bundle these breaking changes together and minimize the amount of version churn.
## Status
Accepted.
## Footnotes
##### footnote-1
In the original `holidays` ruby library all definitions were housed in the same directory. The definitions were split into a separate repository starting with [holidays gem v5.0.0](https://github.com/holidays/holidays/blob/master/CHANGELOG.md#500).

View File

@ -0,0 +1,74 @@
# ECB TARGET Closing Days
#
# Updated: 2014-01-04.
# Sources:
# - http://www.ecb.europa.eu/home/html/holidays.en.html
# - http://www.ecb.europa.eu/press/pr/date/2000/html/pr001214_4.en.html
---
months:
0:
- name: Good Friday
regions: [ecbtarget]
function: easter(year)
function_modifier: -2
- name: Easter Monday
regions: [ecbtarget]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [ecbtarget]
mday: 1
5:
- name: Labour Day
regions: [ecbtarget]
mday: 1
12:
- name: Christmas Day
regions: [ecbtarget]
mday: 25
- name: Christmas Holiday
regions: [ecbtarget]
mday: 26
tests:
- given:
date: '2013-01-01'
regions: ["ecbtarget"]
expect:
name: "New Year's Day"
- given:
date: '2013-05-01'
regions: ["ecbtarget"]
expect:
name: "Labour Day"
- given:
date: '2013-03-29'
regions: ["ecbtarget"]
expect:
name: "Good Friday"
- given:
date: '2013-04-01'
regions: ["ecbtarget"]
expect:
name: "Easter Monday"
- given:
date: '2013-12-25'
regions: ["ecbtarget"]
expect:
name: "Christmas Day"
- given:
date: '2013-12-26'
regions: ["ecbtarget"]
expect:
name: "Christmas Holiday"
- given:
date: '2013-03-29'
regions: ["ecbtarget"]
expect:
name: "Good Friday"
- given:
date: '2013-04-01'
regions: ["ecbtarget"]
expect:
name: "Easter Monday"

123
vendor/holidays/definitions/ee.yaml vendored Normal file
View File

@ -0,0 +1,123 @@
# Estonian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2017-05-25
#
# Changes 2017-06-08:
# - Use small initial letters
# - Good Friday and Easter Sunday aren't informal
# - New Year's Day is always on January 1st
# - Correct Spring Day definition
# - Enhance tests
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Estonia
# - https://www.riigiteataja.ee/akt/13276841?leiaKehtiv
---
months:
0:
- name: suur reede # Good Friday
regions: [ee]
function: easter(year)
function_modifier: -2
- name: ülestõusmispühade 1. püha # Easter Sunday
regions: [ee]
function: easter(year)
- name: nelipühade 1. püha
regions: [ee]
function: easter(year)
function_modifier: 49
1:
- name: uusaasta # New Year's Day
regions: [ee]
mday: 1
2:
- name: iseseisvuspäev # Independence Day
regions: [ee]
mday: 24
5:
- name: kevadpüha # Spring Day
regions: [ee]
mday: 1
6:
- name: võidupüha ja jaanilaupäev # Victory Day
regions: [ee]
mday: 23
- name: jaanipäev # Jaan's Day
regions: [ee]
mday: 24
8:
- name: taasiseseisvumispäev # Day of Restoration of Independence
regions: [ee]
mday: 20
12:
- name: jõululaupäev # Christmas Eve
regions: [ee]
mday: 24
- name: esimene jõulupüha # Christmas Day
regions: [ee]
mday: 25
- name: teine jõulupüha # Boxing Day
regions: [ee]
mday: 26
tests:
- given:
date: '2017-01-01'
regions: ["ee"]
expect:
name: "uusaasta"
- given:
date: '2017-2-24'
regions: ["ee"]
expect:
name: "iseseisvuspäev"
- given:
date: '2017-5-1'
regions: ["ee"]
expect:
name: "kevadpüha"
- given:
date: '2017-6-23'
regions: ["ee"]
expect:
name: "võidupüha ja jaanilaupäev"
- given:
date: '2017-6-24'
regions: ["ee"]
expect:
name: "jaanipäev"
- given:
date: '2017-8-20'
regions: ["ee"]
expect:
name: "taasiseseisvumispäev"
- given:
date: '2017-12-24'
regions: ["ee"]
expect:
name: "jõululaupäev"
- given:
date: '2017-12-25'
regions: ["ee"]
expect:
name: "esimene jõulupüha"
- given:
date: '2017-12-26'
regions: ["ee"]
expect:
name: "teine jõulupüha"
- given:
date: ['2017-4-14', '2018-3-30', '2019-4-19']
regions: ["ee"]
expect:
name: "suur reede"
- given:
date: ['2017-4-16', '2018-4-1', '2019-4-21']
regions: ["ee"]
expect:
name: "ülestõusmispühade 1. püha"
- given:
date: ['2017-6-4', '2018-5-20', '2019-6-9']
regions: ["ee"]
expect:
name: "nelipühade 1. püha"

158
vendor/holidays/definitions/el.yaml vendored Normal file
View File

@ -0,0 +1,158 @@
# Greek holiday definitions for the Ruby Holiday gem.
#
# Created: 2011-05-11.
# Sources:
# http://www.assa.org.au/edm.html
# http://fotios.org/node/1104
# http://www.faqs.org/faqs/calendars/faq/
# http://5dspace-time.org/Calendar/Algorithm.html - for offsets
# http://el.wikipedia.org/wiki/Επίσημες_αργίες_στην_Ελλάδα - for holidays
# http://www.eortologio.gr/arthra/pasxa.php - for holidays
---
months:
0:
- name: Μεγάλη Παρασκευή
regions: [el]
function: orthodox_easter(year)
function_modifier: -2
- name: Μεγάλο Σάββατο
regions: [el]
function: orthodox_easter(year)
function_modifier: -1
- name: Κυριακή του Πάσχα
regions: [el]
function: orthodox_easter(year)
- name: Δευτέρα του Πάσχα
regions: [el]
function: orthodox_easter(year)
function_modifier: 1
- name: Καθαρά Δευτέρα
regions: [el]
function: orthodox_easter(year)
function_modifier: -48
- name: Αγίου Πνεύματος
regions: [el]
function: orthodox_easter(year)
function_modifier: 50
1:
- name: Πρωτοχρονιά
regions: [el]
mday: 1
- name: Θεοφάνεια
regions: [el]
mday: 6
3:
- name: Επέτειος της Επανάστασης του 1821
regions: [el]
mday: 25
5:
- name: Πρωτομαγιά
regions: [el]
mday: 1
8:
- name: Κοίμηση της Θεοτόκου
regions: [el]
mday: 15
10:
- name: Επέτειος του Όχι
regions: [el]
mday: 28
12:
- name: Χριστούγεννα
regions: [el]
mday: 25
- name: Δεύτερη ημέρα των Χριστουγέννων
regions: [el]
mday: 26
tests:
- given:
date: '2011-01-01'
regions: ["el"]
options: ["informal"]
expect:
name: "Πρωτοχρονιά"
- given:
date: '2011-01-06'
regions: ["el"]
options: ["informal"]
expect:
name: "Θεοφάνεια"
- given:
date: '2011-04-22'
regions: ["el"]
options: ["informal"]
expect:
name: "Μεγάλη Παρασκευή"
- given:
date: '1970-04-25'
regions: ["el"]
options: ["informal"]
expect:
name: "Μεγάλο Σάββατο"
- given:
date: '1985-04-14'
regions: ["el"]
options: ["informal"]
expect:
name: "Κυριακή του Πάσχα"
- given:
date: '2011-04-24'
regions: ["el"]
options: ["informal"]
expect:
name: "Κυριακή του Πάσχα"
- given:
date: '2027-05-02'
regions: ["el"]
options: ["informal"]
expect:
name: "Κυριακή του Πάσχα"
- given:
date: '2046-04-30'
regions: ["el"]
options: ["informal"]
expect:
name: "Δευτέρα του Πάσχα"
- given:
date: '2011-05-01'
regions: ["el"]
options: ["informal"]
expect:
name: "Πρωτομαγιά"
- given:
date: '2011-06-13'
regions: ["el"]
options: ["informal"]
expect:
name: "Αγίου Πνεύματος"
- given:
date: '2012-06-04'
regions: ["el"]
options: ["informal"]
expect:
name: "Αγίου Πνεύματος"
- given:
date: '2011-03-07'
regions: ["el"]
options: ["informal"]
expect:
name: "Καθαρά Δευτέρα"
- given:
date: '2012-02-27'
regions: ["el"]
options: ["informal"]
expect:
name: "Καθαρά Δευτέρα"
- given:
date: '2011-12-25'
regions: ["el"]
options: ["informal"]
expect:
name: "Χριστούγεννα"
- given:
date: '2011-12-26'
regions: ["el"]
options: ["informal"]
expect:
name: "Δεύτερη ημέρα των Χριστουγέννων"

495
vendor/holidays/definitions/es.yaml vendored Normal file
View File

@ -0,0 +1,495 @@
# Spanish holiday definitions for the Ruby Holiday gem.
#
# Including the Balearic Islands and the Canary Islands.
#
# Updated: 2008-11-29.
#
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Spain
# - http://www.timeanddate.com/calendar/index.html?country=16
#
# Notes:
# - Valencia is encoded as both es_v and es_vc
months:
0:
- name: Jueves Santo
regions: [es_pv, es_na, es_an, es_ib, es_cm, es_mu, es_m, es_ar, es_cl, es_cn, es_lo, es_ga, es_ce, es_o, es_ex]
function: easter(year)
function_modifier: -3
- name: Viernes Santo
regions: [es]
function: easter(year)
function_modifier: -2
- name: Lunes de Pascua
regions: [es_pv, es_ct, es_na, es_v, es_vc]
function: easter(year)
function_modifier: 1
- name: Lunes de Pascua Granada
regions: [es_ct]
function: easter(year)
function_modifier: 50
1:
- name: Año Nuevo
regions: [es]
mday: 1
observed: to_monday_if_sunday(date)
- name: Día de Reyes
regions: [es]
mday: 6
observed: to_monday_if_sunday(date)
2:
- name: Día de Andalucía
regions: [es_an]
mday: 28
observed: to_monday_if_sunday(date)
3:
- name: Día de las Islas Baleares
regions: [es_ib]
mday: 1
observed: to_monday_if_sunday(date)
- name: San José
regions: [es_v, es_vc, es_cm, es_mu, es_m]
mday: 19
observed: to_monday_if_sunday(date)
4:
- name: Día de Castilla y León
regions: [es_cl]
mday: 23
observed: to_monday_if_sunday(date)
- name: San Jorge, Día de Aragón
regions: [es_ar]
mday: 23
observed: to_monday_if_sunday(date)
5:
- name: Día del Trabajador
regions: [es]
mday: 1
observed: to_monday_if_sunday(date)
- name: Fiesta de la Comunidad
regions: [es_m]
mday: 2
observed: to_monday_if_sunday(date)
- name: Día de las Canarias
regions: [es_cn]
mday: 30
observed: to_monday_if_sunday(date)
- name: Día de la Región Castilla-La Mancha
regions: [es_cm]
mday: 31
observed: to_monday_if_sunday(date)
6:
- name: Día de la Región de Murcia
regions: [es_mu]
mday: 9
observed: to_monday_if_sunday(date)
- name: Día de La Rioja
regions: [es_lo]
mday: 9
observed: to_monday_if_sunday(date)
- name: San Juan
regions: [es_ct, es_vc]
mday: 24
7:
- name: Santiago Apostol
regions: [es_ga]
mday: 23
observed: to_monday_if_sunday(date)
8:
- name: Asunción
regions: [es]
mday: 15
observed: to_monday_if_sunday(date)
9:
- name: Día de Ceuta
regions: [es_ce]
mday: 2
observed: to_monday_if_sunday(date)
- name: Día de Asturias
regions: [es_o]
mday: 8
observed: to_monday_if_sunday(date)
- name: Día de Extremadura
regions: [es_ex]
mday: 8
- name: Fiesta Nacional de Cataluña
regions: [es_ct]
mday: 11
observed: to_monday_if_sunday(date)
- name: La Mercè
regions: [es_ct]
mday: 24
10:
- name: Día de Valencia
regions: [es_vc, es_v]
mday: 9
observed: to_monday_if_sunday(date)
- name: Día de la Hispanidad
regions: [es]
mday: 12
observed: to_monday_if_sunday(date)
11:
- name: Todos los Santos
regions: [es]
mday: 1
observed: to_monday_if_sunday(date)
12:
- name: Día de la Constitución
regions: [es]
mday: 6
observed: to_monday_if_sunday(date)
- name: Inmaculada Concepción
regions: [es]
mday: 8
observed: to_monday_if_sunday(date)
- name: Navidad del Señor
regions: [es]
mday: 25
observed: to_monday_if_sunday(date)
- name: San Esteban
regions: [es_ib, es_ct]
mday: 26
observed: to_monday_if_sunday(date)
tests:
- given:
date: '2009-01-01'
regions: ["es"]
options: ["informal"]
expect:
name: "Año Nuevo"
- given:
date: '2009-01-06'
regions: ["es"]
options: ["informal"]
expect:
name: "Día de Reyes"
- given:
date: '2009-04-10'
regions: ["es"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2009-05-01'
regions: ["es"]
options: ["informal"]
expect:
name: "Día del Trabajador"
- given:
date: '2009-08-15'
regions: ["es"]
options: ["informal"]
expect:
name: "Asunción"
- given:
date: '2009-10-12'
regions: ["es"]
options: ["informal"]
expect:
name: "Día de la Hispanidad"
- given:
date: '2009-11-01'
regions: ["es"]
options: ["informal"]
expect:
name: "Todos los Santos"
- given:
date: '2009-12-06'
regions: ["es"]
options: ["informal"]
expect:
name: "Día de la Constitución"
- given:
date: '2009-12-08'
regions: ["es"]
options: ["informal"]
expect:
name: "Inmaculada Concepción"
- given:
date: '2009-12-25'
regions: ["es"]
options: ["informal"]
expect:
name: "Navidad del Señor"
- given:
date: '2009-04-09'
regions: ["es_pv"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_na"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_an"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_ib"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_cm"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_mu"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_m"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_ar"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_cl"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_cn"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_lo"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_ga"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_ce"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_o"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_ex"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-09'
regions: ["es_"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2009-04-13'
regions: ["es_pv"]
expect:
name: "Lunes de Pascua"
- given:
date: '2009-04-13'
regions: ["es_ct"]
expect:
name: "Lunes de Pascua"
- given:
date: '2009-04-13'
regions: ["es_na"]
expect:
name: "Lunes de Pascua"
- given:
date: '2009-04-13'
regions: ["es_v"]
expect:
name: "Lunes de Pascua"
- given:
date: '2009-04-13'
regions: ["es_vc"]
expect:
name: "Lunes de Pascua"
- given:
date: '2009-04-13'
regions: ["es_"]
expect:
name: "Lunes de Pascua"
- given:
date: '2009-04-09'
regions: ["es_an"]
expect:
name: "Jueves Santo"
- given:
date: '2009-03-19'
regions: ["es_v"]
expect:
name: "San José"
- given:
date: '2009-03-19'
regions: ["es_vc"]
expect:
name: "San José"
- given:
date: '2009-03-19'
regions: ["es_cm"]
expect:
name: "San José"
- given:
date: '2009-03-19'
regions: ["es_mu"]
expect:
name: "San José"
- given:
date: '2009-03-19'
regions: ["es_m"]
expect:
name: "San José"
- given:
date: '2009-03-19'
regions: ["es_"]
expect:
name: "San José"
- given:
date: '2009-04-23'
regions: ["es_cl"]
expect:
name: "Día de Castilla y León"
- given:
date: '2009-04-23'
regions: ["es_ar"]
expect:
name: "San Jorge, Día de Aragón"
- given:
date: '2009-04-23'
regions: ["es_"]
expect:
name: "Día de Castilla y León"
- given:
date: '2009-10-09'
regions: ["es_vc"]
expect:
name: "Día de Valencia"
- given:
date: '2009-10-09'
regions: ["es_v"]
expect:
name: "Día de Valencia"
- given:
date: '2009-10-09'
regions: ["es_"]
expect:
name: "Día de Valencia"
- given:
date: '2009-12-26'
regions: ["es_ib"]
expect:
name: "San Esteban"
- given:
date: '2009-12-26'
regions: ["es_ct"]
expect:
name: "San Esteban"
- given:
date: '2009-12-26'
regions: ["es_"]
expect:
name: "San Esteban"
- given:
date: '2012-01-01'
regions: ["es"]
expect:
name: "Año Nuevo"
- given:
date: '2012-01-02'
regions: ["es"]
options: ["observed"]
expect:
name: "Año Nuevo"
- given:
date: '2009-02-28'
regions: ["es_an"]
expect:
name: "Día de Andalucía"
- given:
date: '2009-03-01'
regions: ["es_ib"]
expect:
name: "Día de las Islas Baleares"
- given:
date: '2006-05-02'
regions: ["es_m"]
expect:
name: "Fiesta de la Comunidad"
- given:
date: '2006-05-30'
regions: ["es_cn"]
expect:
name: "Día de las Canarias"
- given:
date: '2009-05-31'
regions: ["es_cm"]
expect:
name: "Día de la Región Castilla-La Mancha"
- given:
date: '2009-06-09'
regions: ["es_mu"]
expect:
name: "Día de la Región de Murcia"
- given:
date: '2009-06-09'
regions: ["es_lo"]
expect:
name: "Día de La Rioja"
- given:
date: '2009-07-23'
regions: ["es_ga"]
expect:
name: "Santiago Apostol"
- given:
date: '2009-09-02'
regions: ["es_ce"]
expect:
name: "Día de Ceuta"
- given:
date: '2009-09-08'
regions: ["es_o"]
expect:
name: "Día de Asturias"
- given:
date: '2009-09-08'
regions: ["es_ex"]
expect:
name: "Día de Extremadura"
- given:
date: '2009-09-11'
regions: ["es_ct"]
expect:
name: "Fiesta Nacional de Cataluña"
- given:
date: '2020-06-01'
regions: ["es_ct"]
expect:
name: "Lunes de Pascua Granada"

View File

@ -0,0 +1,364 @@
# Federal reserve holidays definition for the Ruby Holiday gem.
#
# Updated: 2018-04-09
#
# Sources:
# - http://www.federalreserve.gov/aboutthefed/k8.htm
---
months:
1:
- name: New Year's Day
regions: [federalreserve]
mday: 1
observed: to_weekday_if_weekend(date)
- name: Birthday of Martin Luther King, Jr
week: 3
wday: 1
regions: [federalreserve]
2:
- name: Washington's Birthday
week: 3
wday: 1
regions: [federalreserve]
5:
- name: Memorial Day
week: -1
wday: 1
regions: [federalreserve]
7:
- name: Independence Day
regions: [federalreserve]
mday: 4
observed: to_weekday_if_weekend(date)
9:
- name: Labor Day
week: 1
regions: [federalreserve]
wday: 1
10:
- name: Columbus Day
week: 2
regions: [federalreserve]
wday: 1
11:
- name: Veterans Day
regions: [federalreserve]
mday: 11
observed: to_weekday_if_weekend(date)
- name: Thanksgiving Day
week: 4
wday: 4
regions: [federalreserve]
12:
- name: Christmas Day
regions: [federalreserve]
mday: 25
observed: to_weekday_if_weekend(date)
tests:
- given:
date: '2012-01-02'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2012-01-16'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2012-02-20'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2012-05-28'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2012-07-04'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2020-07-03'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2012-09-03'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2012-10-08'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2012-11-12'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2012-11-22'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2012-12-25'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2013-01-01'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2013-01-21'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2013-02-18'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2013-05-27'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2013-07-04'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2013-09-02'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2013-10-14'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2013-11-11'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2013-11-28'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2013-12-25'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2014-01-01'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2014-01-20'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2014-02-17'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2014-05-26'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2014-07-04'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2014-09-01'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2014-10-13'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2014-11-11'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2014-11-27'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2014-12-25'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2015-01-01'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2015-01-19'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2015-02-16'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2015-05-25'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2015-07-03'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2015-09-07'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2015-10-12'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2015-11-11'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2015-11-26'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2015-12-25'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2016-01-01'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2016-01-18'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2016-02-15'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2016-05-30'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2016-07-04'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2016-09-05'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2016-10-10'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2016-11-11'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2016-11-24'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2016-12-26'
regions: ["federalreserve"]
options: ["observed"]
expect:
name: "Christmas Day"

View File

@ -0,0 +1,802 @@
# Federal reserve holidays definition for the Ruby Holiday gem.
# Observed option applies to when banks are open:
#
# * If the holiday falls on a Saturday, it is not observed
# * If the holiday falls on a Sunday, it is observed on Monday
#
# Updated: 2019-01-31
#
# Sources:
# - http://www.federalreserve.gov/aboutthefed/k8.htm
---
months:
1:
- name: New Year's Day
regions: [federalreservebanks]
mday: 1
observed: to_monday_if_sunday(date)
- name: Birthday of Martin Luther King, Jr
week: 3
wday: 1
regions: [federalreservebanks]
2:
- name: Washington's Birthday
week: 3
wday: 1
regions: [federalreservebanks]
5:
- name: Memorial Day
week: -1
wday: 1
regions: [federalreservebanks]
7:
- name: Independence Day
regions: [federalreservebanks]
mday: 4
observed: to_monday_if_sunday(date)
9:
- name: Labor Day
week: 1
regions: [federalreservebanks]
wday: 1
10:
- name: Columbus Day
week: 2
regions: [federalreservebanks]
wday: 1
11:
- name: Veterans Day
regions: [federalreservebanks]
mday: 11
observed: to_monday_if_sunday(date)
- name: Thanksgiving Day
week: 4
wday: 4
regions: [federalreservebanks]
12:
- name: Christmas Day
regions: [federalreservebanks]
mday: 25
observed: to_monday_if_sunday(date)
tests:
- given:
date: '2012-01-02'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2012-01-16'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2012-02-20'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2012-05-28'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2012-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2012-09-03'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2012-10-08'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2012-11-12'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2012-11-22'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2012-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2013-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2013-01-21'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2013-02-18'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2013-05-27'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2013-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2013-09-02'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2013-10-14'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2013-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2013-11-28'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2013-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2014-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2014-01-20'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2014-02-17'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2014-05-26'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2014-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2014-09-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2014-10-13'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2014-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2014-11-27'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2014-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2015-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2015-01-19'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2015-02-16'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2015-05-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
# Friday
date: '2015-07-03'
regions: ["federalreservebanks"]
options: ["observed"]
# 2015-07-04 is a Saturday, not observed
expect:
holiday: false
- given:
# Monday
date: '2015-07-06'
regions: ["federalreservebanks"]
options: ["observed"]
# 2015-07-04 is a Saturday, not observed
expect:
holiday: false
- given:
date: '2015-09-07'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2015-10-12'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2015-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2015-11-26'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2015-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2016-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2016-01-18'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2016-02-15'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2016-05-30'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2016-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2016-09-05'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2016-10-10'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2016-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2016-11-24'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2016-12-26'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2019-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2019-01-21'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2019-02-18'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2019-05-27'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2019-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2019-09-02'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2019-10-14'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2019-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2019-11-28'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2019-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2020-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2020-01-20'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2020-02-17'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2020-05-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
# Friday
date: '2020-07-03'
regions: ["federalreservebanks"]
options: ["observed"]
# 2020-07-04 is a Saturday, not observed
expect:
holiday: false
- given:
# Monday
date: '2020-07-06'
regions: ["federalreservebanks"]
options: ["observed"]
# 2020-07-04 is a Saturday, not observed
expect:
holiday: false
- given:
date: '2020-09-07'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2020-10-12'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2020-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2020-11-26'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2020-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2021-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2021-01-18'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2021-02-15'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2021-05-31'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
# Friday
date: '2021-07-02'
regions: ["federalreservebanks"]
options: ["observed"]
# 2021-07-04 is a Sunday, observed on Monday
expect:
holiday: false
- given:
# Monday
date: '2021-07-05'
regions: ["federalreservebanks"]
options: ["observed"]
# 2021-07-04 is a Sunday, observed on Monday
expect:
name: "Independence Day"
- given:
date: '2021-09-06'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2021-10-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2021-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2021-11-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
# Friday
date: '2021-12-24'
regions: ["federalreservebanks"]
options: ["observed"]
# 2021-12-25 is a Saturday, not observed
expect:
holiday: false
- given:
# Monday
date: '2021-12-27'
regions: ["federalreservebanks"]
options: ["observed"]
# 2021-12-25 is a Saturday, not observed
expect:
holiday: false
- given:
# Friday
date: '2021-12-31'
regions: ["federalreservebanks"]
options: ["observed"]
# 2022-01-01 is a Saturday, not observed
expect:
holiday: false
- given:
# Monday
date: '2022-01-03'
regions: ["federalreservebanks"]
options: ["observed"]
# 2022-01-01 is a Saturday, not observed
expect:
holiday: false
- given:
date: '2022-01-17'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2022-02-21'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2022-05-30'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2022-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2022-09-05'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2022-10-10'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2022-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2022-11-24'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
# Friday
date: '2022-12-23'
regions: ["federalreservebanks"]
options: ["observed"]
# 2022-12-25 is a Sunday, observed on Monday
expect:
holiday: false
- given:
# Monday
date: '2022-12-26'
regions: ["federalreservebanks"]
options: ["observed"]
# 2022-12-25 is a Sunday, observed on Monday
expect:
name: "Christmas Day"
- given:
# Friday
date: '2022-12-30'
regions: ["federalreservebanks"]
options: ["observed"]
# 2023-01-01 is a Sunday, observed on Monday
expect:
holiday: false
- given:
# Monday
date: '2023-01-02'
regions: ["federalreservebanks"]
options: ["observed"]
# 2023-01-01 is a Sunday, observed on Monday
expect:
name: "New Year's Day"
- given:
date: '2023-01-16'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2023-02-20'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2023-05-29'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2023-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2023-09-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2023-10-09'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
# Friday
date: '2023-11-10'
regions: ["federalreservebanks"]
options: ["observed"]
# 2023-11-11 is a Saturday, not observed
expect:
holiday: false
- given:
# Monday
date: '2023-11-13'
regions: ["federalreservebanks"]
options: ["observed"]
# 2023-11-11 is a Saturday, not observed
expect:
holiday: false
- given:
date: '2023-11-23'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2023-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2024-01-01'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2024-01-15'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Birthday of Martin Luther King, Jr"
- given:
date: '2024-02-19'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Washington's Birthday"
- given:
date: '2024-05-27'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2024-07-04'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2024-09-02'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2024-10-14'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Columbus Day"
- given:
date: '2024-11-11'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Veterans Day"
- given:
date: '2024-11-28'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Thanksgiving Day"
- given:
date: '2024-12-25'
regions: ["federalreservebanks"]
options: ["observed"]
expect:
name: "Christmas Day"

102
vendor/holidays/definitions/fedex.yaml vendored Normal file
View File

@ -0,0 +1,102 @@
# FedEx holiday definitions for the Ruby Holiday gem.
#
# By Adam Runner
#
# Updated: 2015-03-09.
# Source: http://www.fedex.com/us/service-guide/holiday-schedule.html
---
months:
1:
- name: New Year's Day
regions: [fedex]
mday: 1
observed: to_weekday_if_weekend(date)
5:
- name: Memorial Day
week: -1
regions: [fedex]
wday: 1
7:
- name: Independence Day
regions: [fedex]
mday: 4
observed: to_weekday_if_weekend(date)
9:
- name: Labor Day
week: 1
regions: [fedex]
wday: 1
11:
- name: Thanksgiving
week: 4
regions: [fedex]
wday: 4
- name: Day After Thanksgiving
function: day_after_thanksgiving(year)
regions: [fedex]
12:
- name: Christmas Day
regions: [fedex]
mday: 25
observed: to_weekday_if_weekend(date)
- name: New Year's Eve
regions: [fedex]
mday: 31
methods:
day_after_thanksgiving:
arguments: year
ruby: |
Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 11, 4, 4) + 1
tests:
- given:
date: '2015-01-01'
regions: ["ups"]
expect:
name: "New Year's Day"
- given:
date: '2015-05-25'
regions: ["ups"]
expect:
name: "Memorial Day"
- given:
date: '2015-07-04'
regions: ["ups"]
expect:
name: "Independence Day"
- given:
date: '2015-09-07'
regions: ["ups"]
expect:
name: "Labor Day"
- given:
date: '2015-11-26'
regions: ["ups"]
expect:
name: "Thanksgiving"
- given:
date: '2015-11-27'
regions: ["ups"]
expect:
name: "Day After Thanksgiving"
- given:
date: '2013-11-28'
regions: ["ups"]
expect:
name: "Thanksgiving"
- given:
date: '2013-11-29'
regions: ["ups"]
expect:
name: "Day After Thanksgiving"
- given:
date: '2015-12-25'
regions: ["ups"]
expect:
name: "Christmas Day"
- given:
date: '2015-12-31'
regions: ["ups"]
expect:
name: "New Year's Eve"

234
vendor/holidays/definitions/fi.yaml vendored Normal file
View File

@ -0,0 +1,234 @@
# Finnish holiday definitions for the Ruby Holiday gem.
#
# Updated: 2010-12-28.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Finland
---
months:
0:
- name: Pitkäperjantai
regions: [fi]
function: easter(year)
function_modifier: -2
- name: Pääsiäispäivä
regions: [fi]
function: easter(year)
- name: 2. Pääsiäispäivä
regions: [fi]
function: easter(year)
function_modifier: 1
- name: Helatorstai # Ascension Day
regions: [fi]
function: easter(year)
function_modifier: 39
- name: Helluntaipäivä # Whitsunday
regions: [fi]
function: easter(year)
function_modifier: 49
- name: Pyhäinpäivä # All Saint's Day
regions: [fi]
function: fi_pyhainpaiva(year)
1:
- name: Uudenvuodenpäivä
regions: [fi]
mday: 1
- name: Loppiainen
regions: [fi]
mday: 6
5:
- name: Vappu
regions: [fi]
mday: 1
6:
- name: Juhannusaatto
regions: [fi]
function: fi_juhannusaatto(year)
- name: Juhannuspäivä
regions: [fi]
function: fi_juhannuspaiva(year)
12:
- name: Itsenäisyyspäivä
regions: [fi]
mday: 6
- name: Jouluaatto
regions: [fi]
mday: 24
- name: Joulupäivä
regions: [fi]
mday: 25
- name: Tapaninpäivä
regions: [fi]
mday: 26
methods:
fi_juhannusaatto:
# Finland: Mid-summer eve (Friday between June 1925)
arguments: year
ruby: |
date = Date.civil(year,6,19)
if date.wday > 5 #if 19.6 is saturday
date += 6
else
date += (5 - date.wday)
end
date
fi_juhannuspaiva:
# Finland: Mid-summer (Saturday between June 2026)
arguments: year
ruby: |
date = Date.civil(year,6,20)
date += (6 - date.wday)
date
fi_pyhainpaiva:
# Finland: All Saint's Day (Saturday between Oct 31 and Nov 6)
arguments: year
ruby: |
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
tests:
- given:
date: '2008-01-01'
regions: ["fi"]
options: ["informal"]
expect:
name: "Uudenvuodenpäivä"
- given:
date: '2008-01-06'
regions: ["fi"]
options: ["informal"]
expect:
name: "Loppiainen"
- given:
date: '2008-03-21'
regions: ["fi"]
options: ["informal"]
expect:
name: "Pitkäperjantai"
- given:
date: '2008-03-23'
regions: ["fi"]
options: ["informal"]
expect:
name: "Pääsiäispäivä"
- given:
date: '2008-03-24'
regions: ["fi"]
options: ["informal"]
expect:
name: "2. Pääsiäispäivä"
- given:
date: '2008-05-01'
regions: ["fi"]
options: ["informal"]
expect:
name: "Helatorstai"
- given:
date: '2008-05-11'
regions: ["fi"]
options: ["informal"]
expect:
name: "Helluntaipäivä"
- given:
date: '2009-06-19'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannusaatto"
- given:
date: '2010-06-25'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannusaatto"
- given:
date: '2011-06-24'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannusaatto"
- given:
date: '2012-06-22'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannusaatto"
- given:
date: '2013-06-21'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannusaatto"
- given:
date: '2005-06-25'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannuspäivä"
- given:
date: '2006-06-24'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannuspäivä"
- given:
date: '2007-06-23'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannuspäivä"
- given:
date: '2008-06-21'
regions: ["fi"]
options: ["informal"]
expect:
name: "Juhannuspäivä"
- given:
date: '2005-11-05'
regions: ["fi"]
options: ["informal"]
expect:
name: "Pyhäinpäivä"
- given:
date: '2006-11-04'
regions: ["fi"]
options: ["informal"]
expect:
name: "Pyhäinpäivä"
- given:
date: '2007-11-03'
regions: ["fi"]
options: ["informal"]
expect:
name: "Pyhäinpäivä"
- given:
date: '2008-11-01'
regions: ["fi"]
options: ["informal"]
expect:
name: "Pyhäinpäivä"
- given:
date: '2008-12-06'
regions: ["fi"]
options: ["informal"]
expect:
name: "Itsenäisyyspäivä"
- given:
date: '2008-12-24'
regions: ["fi"]
options: ["informal"]
expect:
name: "Jouluaatto"
- given:
date: '2008-12-25'
regions: ["fi"]
options: ["informal"]
expect:
name: "Joulupäivä"
- given:
date: '2008-12-26'
regions: ["fi"]
options: ["informal"]
expect:
name: "Tapaninpäivä"

157
vendor/holidays/definitions/fr.yaml vendored Normal file
View File

@ -0,0 +1,157 @@
# French holiday definitions for the Ruby Holiday gem.
#
# Updated: 2013-10-2*.
#
# Changes 2017-05-31:
# - Add additional holidays for Alsace (fr_a) and Moselle (fr_m)
#
# Sources:
# - http://fr.wikipedia.org/wiki/Jours_f%C3%A9ri%C3%A9s_en_France#Les_f.C3.AAtes_f.C3.A9ri.C3.A9es
# - http://vosdroits.service-public.fr/particuliers/F2405.xhtml
# - https://en.wikipedia.org/wiki/Public_holidays_in_France
---
months:
0:
- name: Vendredi saint
regions: [fr_a, fr_m]
function: easter(year)
function_modifier: -2
- name: Pâques
regions: [fr]
function: easter(year)
type: informal
- name: Lundi de Pâques
regions: [fr]
function: easter(year)
function_modifier: 1
- name: Ascension
regions: [fr]
function: easter(year)
function_modifier: 39
- name: Pentecôte
regions: [fr]
function: easter(year)
function_modifier: 49
type: informal
- name: Lundi de Pentecôte
regions: [fr]
function: easter(year)
function_modifier: 50
1:
- name: Jour de l'an
regions: [fr]
mday: 1
5:
- name: Fête du travail
regions: [fr]
mday: 1
- name: Victoire 1945
regions: [fr]
mday: 8
7:
- name: Fête nationale
regions: [fr]
mday: 14
8:
- name: Assomption
regions: [fr]
mday: 15
11:
- name: Toussaint
regions: [fr]
mday: 1
- name: Armistice 1918
regions: [fr]
mday: 11
12:
- name: Noël
regions: [fr]
mday: 25
- name: Saint-Étienne
regions: [fr_a, fr_m]
mday: 26
tests:
- given:
date: '2007-01-01'
regions: ["fr"]
expect:
name: "Jour de l'an"
- given:
date: '2007-04-09'
regions: ["fr"]
expect:
name: "Lundi de Pâques"
- given:
date: '2007-05-01'
regions: ["fr"]
expect:
name: "Fête du travail"
- given:
date: '2007-05-08'
regions: ["fr"]
expect:
name: "Victoire 1945"
- given:
date: '2007-05-17'
regions: ["fr"]
expect:
name: "Ascension"
- given:
date: '2007-05-28'
regions: ["fr"]
expect:
name: "Lundi de Pentecôte"
- given:
date: '2007-07-14'
regions: ["fr"]
expect:
name: "Fête nationale"
- given:
date: '2007-08-15'
regions: ["fr"]
expect:
name: "Assomption"
- given:
date: '2007-11-01'
regions: ["fr"]
expect:
name: "Toussaint"
- given:
date: '2007-11-11'
regions: ["fr"]
expect:
name: "Armistice 1918"
- given:
date: '2007-12-25'
regions: ["fr"]
expect:
name: "Noël"
- given:
date: '2007-04-08'
regions: ["fr"]
expect:
holiday: false
- given:
date: '2007-05-27'
regions: ["fr"]
expect:
holiday: false
- given:
date: '2007-04-08'
regions: ["fr"]
options: ["informal"]
expect:
name: "Pâques"
- given:
date: '2007-05-27'
regions: ["fr"]
options: ["informal"]
expect:
name: "Pentecôte"
- given:
date: '2017-12-26'
regions: ["fr_a", "fr_m"]
options: ["informal"]
expect:
name: "Saint-Étienne"

458
vendor/holidays/definitions/gb.yaml vendored Normal file
View File

@ -0,0 +1,458 @@
# Great Britain/United Kingdom holiday definitions for the Ruby Holiday gem.
#
# Including England, Wales, Scotland, N. Ireland, the Isle of Man, Guernsey
# and Jersey.
#
# Updated: 2019-02-10
# Sources:
# - http://en.wikipedia.org/wiki/List_of_holidays_by_country#United_Kingdom_and_Crown_dependencies
#
# Notes:
# - Jersey, Guernsey and the Isle of Man are encode with both their ISO 3166-1 and ISO 3-3166-2 codes.
# - England and Wales together should be encoded as [gb_eng, gb_wls, gb_eaw...]
# - For :gb_sct, St. Andrew's Day is 'informal' 2006 and earlier but a bank holiday from 2007 on.
---
months:
0:
- name: Good Friday
regions: [gb]
function: easter(year)
function_modifier: -2
- name: Easter Sunday
regions: [gb]
function: easter(year)
- name: Easter Monday
regions: [gb_eng, gb_wls, gb_eaw, gb_nir, je, gb_jsy, gg, gb_gsy]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [gb]
mday: 1
observed: to_monday_if_weekend(date)
- name: 2nd January
regions: [gb_sct]
mday: 2
observed: to_weekday_if_boxing_weekend(date)
3:
- name: St. Piran's Day
regions: [gb_con]
mday: 5
- name: St. Patrick's Day
regions: [gb_nir]
mday: 17
observed: to_monday_if_weekend(date)
5:
- name: May Day
regions: [gb]
week: 1
wday: 1
year_ranges:
until: 2019
- name: May Day
regions: [gb]
mday: 8
year_ranges:
limited: [2020]
- name: May Day
regions: [gb]
week: 1
wday: 1
year_ranges:
from: 2021
- name: Liberation Day
regions: [je, gb_jsy, gg, gb_gsy]
mday: 9
- name: Bank Holiday
regions: [gb]
week: -1
wday: 1
7:
- name: Tynwald Day
regions: [im, gb_iom]
mday: 5
- name: Battle of the Boyne
regions: [gb_nir]
mday: 12
observed: to_monday_if_weekend(date)
8:
- name: Bank Holiday
regions: [gb_sct]
week: 1
wday: 1
- name: Bank Holiday
regions: [gb_eng, gb_wls, gb_eaw, gb_nir, je, gb_jsy, gg, gb_gsy]
week: -1
wday: 1
11:
- name: Guy Fawkes Day
regions: [gb]
mday: 5
type: informal
- name: St. Andrew's Day
regions: [gb_sct]
mday: 30
type: informal
observed: to_monday_if_weekend(date)
year_ranges:
until: 2006
- name: St. Andrew's Day
regions: [gb_sct]
mday: 30
observed: to_monday_if_weekend(date)
year_ranges:
from: 2007
12:
- name: Christmas Day
regions: [gb]
mday: 25
observed: to_monday_if_weekend(date)
- name: Boxing Day
regions: [gb]
mday: 26
observed: to_weekday_if_boxing_weekend(date)
tests:
- given:
date: '2008-03-21'
regions: ["gb"]
options: ["informal"]
expect:
name: "Good Friday"
- given:
date: '2008-03-23'
regions: ["gb"]
options: ["informal"]
expect:
name: "Easter Sunday"
- given:
date: '2008-05-05'
regions: ["gb"]
options: ["informal"]
expect:
name: "May Day"
- given:
date: '2008-05-26'
regions: ["gb"]
options: ["informal"]
expect:
name: "Bank Holiday"
- given:
date: '2008-11-05'
regions: ["gb"]
options: ["informal"]
expect:
name: "Guy Fawkes Day"
- given:
date: '2008-12-25'
regions: ["gb"]
options: ["informal"]
expect:
name: "Christmas Day"
- given:
date: '2008-12-26'
regions: ["gb"]
options: ["informal"]
expect:
name: "Boxing Day"
- given:
date: '2008-03-17'
regions: ["gb_nir"]
options: ["informal"]
expect:
name: "St. Patrick's Day"
- given:
date: '2018-03-17'
regions: ["gb_nir"]
options: ["informal"]
expect:
name: "St. Patrick's Day"
- given:
date: '2018-03-19'
regions: ["gb_nir"]
options: ["observed", "informal"]
expect:
name: "St. Patrick's Day"
- given:
date: '2019-03-17'
regions: ["gb_nir"]
options: ["informal"]
expect:
name: "St. Patrick's Day"
- given:
date: '2019-03-18'
regions: ["gb_nir"]
options: ["observed", "informal"]
expect:
name: "St. Patrick's Day"
- given:
date: '2020-07-12'
regions: ["gb_nir"]
expect:
name: "Battle of the Boyne"
- given:
date: '2020-07-12'
regions: ["gb_nir"]
options: ["observed"]
expect:
holiday: false
- given:
date: '2020-07-13'
regions: ["gb_nir"]
options: ["observed"]
expect:
name: "Battle of the Boyne"
- given:
date: '2008-07-12'
regions: ["gb_nir"]
expect:
name: "Battle of the Boyne"
- given:
date: '2008-07-14'
regions: ["gb_nir"]
options: ["observed"]
expect:
name: "Battle of the Boyne"
- given:
date: '2021-07-12'
regions: ["gb_nir"]
expect:
name: "Battle of the Boyne"
- given:
date: '2021-07-12'
regions: ["gb_nir"]
options: ["observed"]
expect:
name: "Battle of the Boyne"
- given:
date: '2021-07-13'
regions: ["gb_nir"]
options: ["observed"]
expect:
holiday: false
- given:
date: '2006-11-30'
regions: ["gb_sct"]
options: ["informal"]
expect:
name: "St. Andrew's Day"
- given:
date: '2006-11-30'
regions: ["gb_sct"]
options: ["informal", "observed"]
expect:
name: "St. Andrew's Day"
- given:
date: '2002-12-02'
regions: ["gb_sct"]
options: ["informal", "observed"]
expect:
name: "St. Andrew's Day"
- given:
date: '2004-11-30'
regions: ["gb_sct"]
expect:
holiday: false
- given:
date: '2005-11-30'
regions: ["gb_sct"]
expect:
holiday: false
- given:
date: '2006-11-30'
regions: ["gb_sct"]
expect:
holiday: false
- given:
date: '2007-11-30'
regions: ["gb_sct"]
expect:
name: "St. Andrew's Day"
- given:
date: '2007-11-30'
regions: ["gb_sct"]
options: ["informal"]
expect:
name: "St. Andrew's Day"
- given:
date: '2007-11-30'
regions: ["gb_sct"]
options: ["informal", "observed"]
expect:
name: "St. Andrew's Day"
- given:
date: '2016-11-30'
regions: ["gb_sct"]
expect:
name: "St. Andrew's Day"
- given:
date: '2019-11-30'
regions: ["gb_sct"]
expect:
name: "St. Andrew's Day"
- given:
date: '2019-11-30'
regions: ["gb_sct"]
expect:
name: "St. Andrew's Day"
- given:
date: '2019-12-2'
regions: ["gb_sct"]
options: ["observed"]
expect:
name: "St. Andrew's Day"
- given:
date: '2008-12-25'
regions: ["gb_"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2009-12-25'
regions: ["gb_"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2010-12-27'
regions: ["gb_"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2008-12-26'
regions: ["gb_"]
options: ["observed"]
expect:
name: "Boxing Day"
- given:
date: '2009-12-28'
regions: ["gb_"]
options: ["observed"]
expect:
name: "Boxing Day"
- given:
date: '2010-12-28'
regions: ["gb_"]
options: ["observed"]
expect:
name: "Boxing Day"
- given:
date: '2011-12-27'
regions: ["gb_"]
options: ["observed"]
expect:
name: "Boxing Day"
- given:
date: '2010-01-01'
regions: ["gb"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2011-01-03'
regions: ["gb"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2012-01-02'
regions: ["gb"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2010-01-04'
regions: ["gb_sct"]
options: ["observed"]
expect:
name: "2nd January"
- given:
date: '2011-01-04'
regions: ["gb_sct"]
options: ["observed"]
expect:
name: "2nd January"
- given:
date: '2012-01-03'
regions: ["gb_sct"]
options: ["observed"]
expect:
name: "2nd January"
- given:
date: '2013-01-02'
regions: ["gb_sct"]
options: ["observed"]
expect:
name: "2nd January"
- given:
date: '2014-01-02'
regions: ["gb_sct"]
options: ["observed"]
expect:
name: "2nd January"
- given:
date: '2008-03-24'
regions: ["gb_wls"]
expect:
name: "Easter Monday"
- given:
date: '2008-08-25'
regions: ["gb_wls"]
expect:
name: "Bank Holiday"
- given:
date: '2008-03-24'
regions: ["gb_eng"]
expect:
name: "Easter Monday"
- given:
date: '2008-08-25'
regions: ["gb_eng"]
expect:
name: "Bank Holiday"
- given:
date: '2008-03-24'
regions: ["gb_nir"]
expect:
name: "Easter Monday"
- given:
date: '2008-08-25'
regions: ["gb_nir"]
expect:
name: "Bank Holiday"
- given:
date: '2008-03-24'
regions: ["gb_eaw"]
expect:
name: "Easter Monday"
- given:
date: '2008-08-25'
regions: ["gb_eaw"]
expect:
name: "Bank Holiday"
- given:
date: '2008-03-24'
regions: ["gb_"]
expect:
name: "Easter Monday"
- given:
date: '2008-08-25'
regions: ["gb_"]
expect:
name: "Bank Holiday"
- given:
date: '2018-05-09'
regions: ["je"]
expect:
name: "Liberation Day"
- given:
date: '2018-04-02'
regions: ["je"]
expect:
name: "Easter Monday"
- given:
date: '2018-08-27'
regions: ["je"]
expect:
name: "Bank Holiday"

158
vendor/holidays/definitions/ge.yaml vendored Normal file
View File

@ -0,0 +1,158 @@
# Georgian holiday definitions for the Ruby Holiday gem. In Georgian (საქართველო).
#
# Updated: 2017-06-12
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Georgia
# - https://de.wikipedia.org/wiki/Feiertage_in_Georgien
# - https://translate.yandex.com/?lang=ka-en
---
months:
0:
- name: დიდი პარასკევი # Good Friday
regions: [ge]
function: orthodox_easter(year)
function_modifier: -2
- name: დიდი შაბათი # Holy Saturday
regions: [ge]
function: orthodox_easter(year)
function_modifier: -1
- name: ბრწყინვალე აღდგომის დღე # Easter Sunday
regions: [ge]
function: orthodox_easter(year)
- name: მიცვალებულთა # Easter Monday
regions: [ge]
function: orthodox_easter(year)
function_modifier: 1
1:
- name: ახალი წელი # New Year's Day
regions: [ge]
mday: 1
- name: ბედობა # Day after New Year's Day
regions: [ge]
mday: 2
- name: ქრისტეშობა # Christmas Day
regions: [ge]
mday: 7
- name: ნათლისღება # Baptism Day of our Lord Jesus Christ
regions: [ge]
mday: 19
3:
- name: დედის დღე # Mother's Day
regions: [ge]
mday: 3
- name: ქალთა საერთაშორისო დღე # International Women's Day
regions: [ge]
mday: 8
4:
- name: ეროვნული ერთიანობის დღე # Day of National Unity
regions: [ge]
mday: 9
5:
- name: ფაშიზმზე გამარჯვების დღე # Victory Day
regions: [ge]
mday: 9
- name: წმინდა მოციქულის ანდრია პირველწოდებულის საქართველოში შემოსვლის დღე # Saint Andrew the First-Called Day
regions: [ge]
mday: 12
- name: დამოუკიდებლობის დღე # Independence Day
regions: [ge]
mday: 26
8:
- name: მარიამობა # Saint Mary's Day
regions: [ge]
mday: 28
10:
- name: სვეტიცხოვლობა # Day of Svetitskhoveli Cathedral (in Mtskheta)
regions: [ge]
mday: 14
11:
- name: გიორგობა # Saint George's Day
regions: [ge]
mday: 23
tests:
- given:
date: '2017-1-1'
regions: ["ge"]
expect:
name: "ახალი წელი"
- given:
date: '2017-1-2'
regions: ["ge"]
expect:
name: "ბედობა"
- given:
date: '2017-1-7'
regions: ["ge"]
expect:
name: "ქრისტეშობა"
- given:
date: '2017-1-19'
regions: ["ge"]
expect:
name: "ნათლისღება"
- given:
date: '2017-3-3'
regions: ["ge"]
expect:
name: "დედის დღე"
- given:
date: '2017-3-8'
regions: ["ge"]
expect:
name: "ქალთა საერთაშორისო დღე"
- given:
date: '2017-4-9'
regions: ["ge"]
expect:
name: "ეროვნული ერთიანობის დღე"
- given:
date: '2017-5-9'
regions: ["ge"]
expect:
name: "ფაშიზმზე გამარჯვების დღე"
- given:
date: '2017-5-12'
regions: ["ge"]
expect:
name: "წმინდა მოციქულის ანდრია პირველწოდებულის საქართველოში შემოსვლის დღე"
- given:
date: '2017-5-26'
regions: ["ge"]
expect:
name: "დამოუკიდებლობის დღე"
- given:
date: '2017-8-28'
regions: ["ge"]
expect:
name: "მარიამობა"
- given:
date: '2017-10-14'
regions: ["ge"]
expect:
name: "სვეტიცხოვლობა"
- given:
date: '2017-11-23'
regions: ["ge"]
expect:
name: "გიორგობა"
- given:
date: ['2017-4-14', '2018-4-6', '2019-4-26']
regions: ["ge"]
expect:
name: "დიდი პარასკევი"
- given:
date: ['2017-4-15', '2018-4-7', '2019-4-27']
regions: ["ge"]
expect:
name: "დიდი შაბათი"
- given:
date: ['2017-4-16', '2018-4-8', '2019-4-28']
regions: ["ge"]
expect:
name: "ბრწყინვალე აღდგომის დღე"
- given:
date: ['2017-4-17', '2018-4-9', '2019-4-29']
regions: ["ge"]
expect:
name: "მიცვალებულთა"

287
vendor/holidays/definitions/hk.yaml vendored Normal file
View File

@ -0,0 +1,287 @@
# Hong Kong holiday definitions for the Holidays gem!
# Days not included in the definitions (yet):
# Ching Ming Festival
# The Birthday of the Buddha
# Tuen Ng Festival
# Chinese Mid-Autumn Festival
# Chung Yeung Festival
# Source:
# http://www.gov.hk/en/about/abouthk/holiday/
months:
0:
- name: Lunar New Year's Day
regions: [hk]
function: cn_new_lunar_day(year)
observed: to_monday_if_sunday(date)
- name: The second day of Lunar New Year
regions: [hk]
function: cn_new_lunar_day(year)
function_modifier: 1
observed: to_monday_if_sunday(date)
- name: The third day of Lunar New Year
regions: [hk]
function: cn_new_lunar_day(year)
function_modifier: 2
observed: to_weekday_if_boxing_weekend(date)
- name: Good Friday
regions: [hk]
function: easter(year)
function_modifier: -2
- name: The day following Good Friday
regions: [hk]
function: easter(year)
function_modifier: -1
- name: Easter Monday
regions: [hk]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [hk]
mday: 1
observed: to_monday_if_sunday(date)
5:
- name: Labour Day
regions: [hk]
mday: 1
observed: to_monday_if_sunday(date)
7:
- name: Hong Kong Special Administrative Region Establishment Day
regions: [hk]
mday: 1
observed: to_monday_if_sunday(date)
10:
- name: National Day
regions: [hk]
mday: 1
observed: to_monday_if_sunday(date)
12:
- name: Christmas Day
regions: [hk]
mday: 25
observed: to_monday_if_weekend(date)
- name: Boxing Day
regions: [hk]
mday: 26
observed: to_weekday_if_boxing_weekend(date)
methods:
cn_new_lunar_day:
arguments: year
ruby: |
month_day = case year
when 1930, 1949, 1987, 2025, 2063, 2082, 2101, 2112, 2131, 2150, 2207, 2245, 2253, 2283, 2321
[1, 29]
when 1931, 1950, 1969, 1988, 2007, 2026, 2045, 2083, 2091, 2102, 2121, 2159, 2197, 2208, 2216, 2227, 2246, 2265, 2303, 2322, 2341, 2379
[2, 17]
when 1932, 1951, 1970, 1989, 2027, 2046, 2114, 2179, 2198, 2209, 2247, 2266, 2304, 2323, 2342, 2361, 2399
[2, 6]
when 1933, 2009, 2028, 2047, 2066, 2085, 2115, 2161, 2199, 2210, 2229, 2267, 2305, 2316, 2324, 2335, 2381
[1, 26]
when 1934, 1953, 2037, 2048, 2067, 2086, 2105, 2116, 2181, 2189, 2211, 2257, 2268, 2306, 2325, 2336
[2, 14]
when 1935, 1943, 1992, 2038, 2106, 2144, 2201, 2212, 2258, 2296, 2307, 2326, 2364
[2, 4]
when 1936, 1955, 2001, 2039, 2058, 2088, 2107, 2164, 2183, 2221, 2259, 2278, 2308, 2327, 2373
[1, 24]
when 1937, 1975, 2032, 2040, 2051, 2070, 2108, 2127, 2146, 2165, 2252, 2260, 2271, 2290, 2309, 2328, 2347, 2366
[2, 11]
when 1938, 1957, 1976, 1995, 2014, 2033, 2071, 2109, 2128, 2185, 2272, 2291, 2329, 2348, 2367, 2386
[1, 31]
when 1939, 1996, 2015, 2053, 2072, 2110, 2129, 2292, 2330, 2368, 2387
[2, 19]
when 1940, 1959, 2016, 2035, 2081, 2130, 2149, 2187, 2206, 2225, 2236, 2255, 2312, 2350, 2358, 2369
[2, 8]
when 1941, 1952, 1971, 1990, 2074, 2093, 2123, 2142, 2180, 2248, 2294, 2343, 2351, 2362
[1, 27]
when 1942, 1961, 1972, 1991, 2056, 2075, 2094, 2124, 2143, 2200, 2276, 2295, 2344, 2363
[2, 15]
when 1944, 1963, 1982, 2020, 2096, 2134, 2153, 2172, 2191, 2202, 2240, 2286, 2354, 2392
[1, 25]
when 1945, 1964, 1983, 2010, 2029, 2162, 2192, 2230, 2249, 2317, 2382
[2, 13]
when 1946, 2003, 2022, 2041, 2052, 2098, 2147, 2155, 2166, 2223, 2242, 2261, 2299, 2310, 2375, 2394
[2, 1]
when 1947, 2004, 2042, 2050, 2080, 2118, 2137, 2194, 2270, 2289, 2300, 2338, 2376
[1, 22]
when 1948, 1994, 2013, 2024, 2043, 2089, 2119, 2138, 2157, 2176, 2195, 2214, 2320, 2396
[2, 10]
when 1954, 1973, 2011, 2057, 2068, 2087, 2125, 2163, 2231, 2277, 2288, 2345, 2383
[2, 3]
when 1956, 2002, 2021, 2059, 2078, 2097, 2135, 2154, 2173, 2184, 2203, 2222, 2241, 2279, 2287, 2298, 2355, 2374, 2393
[2, 12]
when 1958, 1977, 2034, 2140, 2178, 2235, 2254, 2273, 2311, 2349, 2360, 2398
[2, 18]
when 1960, 1979, 1998, 2006, 2017, 2036, 2055, 2104, 2169, 2188, 2218, 2226, 2237, 2256, 2275, 2313, 2332, 2370, 2389
[1, 28]
when 1962, 1981, 2000, 2019, 2065, 2076, 2084, 2095, 2133, 2152, 2171, 2190, 2220, 2239, 2285, 2315, 2334, 2353, 2372, 2391
[2, 5]
when 1965, 1984, 2030, 2049, 2060, 2079, 2117, 2136, 2174, 2182, 2193, 2204, 2250, 2269, 2280, 2318, 2337, 2356
[2, 2]
when 1966, 2023, 2061, 2099, 2186, 2262, 2281, 2357, 2395
[1, 21]
when 1967, 1986, 2005, 2062, 2100, 2168, 2233, 2244, 2263, 2282, 2301, 2339, 2377, 2385, 2388
[2, 9]
when 1968, 2044, 2090, 2120, 2139, 2158, 2177, 2196, 2215, 2234, 2264, 2302, 2340, 2359, 2378, 2397
[1, 30]
when 1974, 1993, 2012, 2031, 2069, 2077, 2126, 2145, 2156, 2175, 2213, 2232, 2251, 2297, 2346, 2365, 2384
[1, 23]
when 1978, 1997, 2008, 2054, 2073, 2092, 2103, 2111, 2122, 2141, 2160, 2217, 2228, 2274, 2293, 2331, 2380
[2, 7]
when 1980, 1999, 2018, 2064, 2113, 2132, 2151, 2170, 2219, 2238, 2284, 2314, 2333, 2352, 2371, 2390
[2, 16]
when 1985, 2148, 2167, 2205, 2224, 2243
[2, 20]
when 2319
[2, 21]
end
Date.civil(year, month_day[0], month_day[1])
tests:
- given:
date: '2016-01-01'
regions: ["hk"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2016-02-08'
regions: ["hk"]
options: ["observed"]
expect:
name: "Lunar New Year's Day"
- given:
date: '2016-02-09'
regions: ["hk"]
options: ["observed"]
expect:
name: "The second day of Lunar New Year"
- given:
date: '2016-02-10'
regions: ["hk"]
options: ["observed"]
expect:
name: "The third day of Lunar New Year"
- given:
date: '2016-03-25'
regions: ["hk"]
options: ["observed"]
expect:
name: "Good Friday"
- given:
date: '2016-03-26'
regions: ["hk"]
options: ["observed"]
expect:
name: "The day following Good Friday"
- given:
date: '2016-03-28'
regions: ["hk"]
options: ["observed"]
expect:
name: "Easter Monday"
- given:
date: '2016-05-02'
regions: ["hk"]
options: ["observed"]
expect:
name: "Labour Day"
- given:
date: '2016-07-01'
regions: ["hk"]
options: ["observed"]
expect:
name: "Hong Kong Special Administrative Region Establishment Day"
- given:
date: '2016-10-01'
regions: ["hk"]
options: ["observed"]
expect:
name: "National Day"
- given:
date: '2016-12-26'
regions: ["hk"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2016-12-27'
regions: ["hk"]
options: ["observed"]
expect:
name: "Boxing Day"
- given:
date: '2017-01-02'
regions: ["hk"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2017-01-28'
regions: ["hk"]
options: ["observed"]
expect:
name: "Lunar New Year's Day"
- given:
date: '2017-01-30'
regions: ["hk"]
options: ["observed"]
expect:
name: "The second day of Lunar New Year"
- given:
date: '2017-01-31'
regions: ["hk"]
options: ["observed"]
expect:
name: "The third day of Lunar New Year"
- given:
date: '2017-04-14'
regions: ["hk"]
options: ["observed"]
expect:
name: "Good Friday"
- given:
date: '2017-04-15'
regions: ["hk"]
options: ["observed"]
expect:
name: "The day following Good Friday"
- given:
date: '2017-04-17'
regions: ["hk"]
options: ["observed"]
expect:
name: "Easter Monday"
- given:
date: '2017-05-01'
regions: ["hk"]
options: ["observed"]
expect:
name: "Labour Day"
- given:
date: '2017-07-01'
regions: ["hk"]
options: ["observed"]
expect:
name: "Hong Kong Special Administrative Region Establishment Day"
- given:
date: '2017-10-02'
regions: ["hk"]
options: ["observed"]
expect:
name: "National Day"
- given:
date: '2017-12-25'
regions: ["hk"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2017-12-26'
regions: ["hk"]
options: ["observed"]
expect:
name: "Boxing Day"

171
vendor/holidays/definitions/hr.yaml vendored Normal file
View File

@ -0,0 +1,171 @@
# Croatian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2019-11-21.
# Sources:
# http://en.wikipedia.org/wiki/Public_holidays_in_Croatia
---
months:
0:
- name: Uskrs
regions: [hr]
function: easter(year)
- name: Uskrsni ponedjeljak
regions: [hr]
function: easter(year)
function_modifier: 1
- name: Tijelovo
regions: [hr]
function: easter(year)
function_modifier: 60
1:
- name: Nova godina
regions: [hr]
mday: 1
- name: Bogojavljenje ili Sveta tri kralja
regions: [hr]
mday: 6
5:
- name: Praznik rada
regions: [hr]
mday: 1
- name: Dan državnosti
regions: [hr]
mday: 30
year_ranges:
from: 2020
6:
- name: Dan antifašističke borbe
regions: [hr]
mday: 22
- name: Dan državnosti
regions: [hr]
mday: 25
year_ranges:
until: 2019
8:
- name: Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja
regions: [hr]
mday: 5
- name: Velika Gospa
regions: [hr]
mday: 15
10:
- name: Dan neovisnosti
regions: [hr]
mday: 8
year_ranges:
until: 2019
11:
- name: Svi sveti
regions: [hr]
mday: 1
- name: Dan sjećanja na žrtve Domovinskog rata i Dan sjećanja na žrtvu Vukovara i Škabrnje
regions: [hr]
mday: 18
year_ranges:
from: 2020
12:
- name: Božić
regions: [hr]
mday: 25
- name: Sveti Stjepan
regions: [hr]
mday: 26
tests:
- given:
date: '2012-01-01'
regions: ["hr"]
options: ["informal"]
expect:
name: "Nova godina"
- given:
date: '2012-01-06'
regions: ["hr"]
options: ["informal"]
expect:
name: "Bogojavljenje ili Sveta tri kralja"
- given:
date: '2012-05-01'
regions: ["hr"]
options: ["informal"]
expect:
name: "Praznik rada"
- given:
date: '2012-06-22'
regions: ["hr"]
options: ["informal"]
expect:
name: "Dan antifašističke borbe"
- given:
date: '2020-05-30'
regions: ["hr"]
options: ["informal"]
expect:
name: "Dan državnosti"
- given:
date: '2012-08-05'
regions: ["hr"]
options: ["informal"]
expect:
name: "Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja"
- given:
date: '2012-08-15'
regions: ["hr"]
options: ["informal"]
expect:
name: "Velika Gospa"
- given:
date: '2020-11-18'
regions: ["hr"]
options: ["informal"]
expect:
name: "Dan sjećanja na žrtve Domovinskog rata i Dan sjećanja na žrtvu Vukovara i Škabrnje"
- given:
date: '2012-11-01'
regions: ["hr"]
options: ["informal"]
expect:
name: "Svi sveti"
- given:
date: '2012-12-25'
regions: ["hr"]
options: ["informal"]
expect:
name: "Božić"
- given:
date: '2012-12-26'
regions: ["hr"]
options: ["informal"]
expect:
name: "Sveti Stjepan"
- given:
date: '2008-05-22'
regions: ["hr"]
expect:
name: "Tijelovo"
- given:
date: '2009-06-11'
regions: ["hr"]
expect:
name: "Tijelovo"
- given:
date: '2010-06-03'
regions: ["hr"]
expect:
name: "Tijelovo"
- given:
date: '2012-06-07'
regions: ["hr"]
expect:
name: "Tijelovo"
- given:
date: '2013-05-30'
regions: ["hr"]
expect:
name: "Tijelovo"
- given:
date: '2014-06-19'
regions: ["hr"]
expect:
name: "Tijelovo"

156
vendor/holidays/definitions/hu.yaml vendored Normal file
View File

@ -0,0 +1,156 @@
# Hungarian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2012-03-01 by spap
---
months:
0:
- name: Nagypéntek
regions: [hu]
function: easter(year)
function_modifier: -2
year_ranges:
from: 2017
- name: Húsvéthétfő
regions: [hu]
function: easter(year)
function_modifier: 1
- name: Pünkösdhétfő
regions: [hu]
function: easter(year)
function_modifier: 50
1:
- name: Újév
regions: [hu]
mday: 1
3:
- name: 1848/49-es forradalom és szabadságharc ünnepe
regions: [hu]
mday: 15
5:
- name: A munka ünnepe
regions: [hu]
mday: 1
8:
- name: Az államalapítás ünnepe
regions: [hu]
mday: 20
10:
- name: 1956-os forradalom és szabadságharc ünnepe
regions: [hu]
mday: 23
11:
- name: Mindenszentek
regions: [hu]
mday: 1
12:
- name: Karácsony
regions: [hu]
mday: 25
- name: Karácsony
regions: [hu]
mday: 26
tests:
- given:
date: '2012-01-01'
regions: ["hu"]
options: ["informal"]
expect:
name: "Újév"
- given:
date: '2011-01-01'
regions: ["hu"]
options: ["informal"]
expect:
name: "Újév"
- given:
date: '2012-03-15'
regions: ["hu"]
options: ["informal"]
expect:
name: "1848/49-es forradalom és szabadságharc ünnepe"
- given:
date: '2011-04-25'
regions: ["hu"]
options: ["informal"]
expect:
name: "Húsvéthétfő"
- given:
date: '2012-04-09'
regions: ["hu"]
options: ["informal"]
expect:
name: "Húsvéthétfő"
- given:
date: '2012-05-01'
regions: ["hu"]
options: ["informal"]
expect:
name: "A munka ünnepe"
- given:
date: '2011-06-13'
regions: ["hu"]
options: ["informal"]
expect:
name: "Pünkösdhétfő"
- given:
date: '2012-05-28'
regions: ["hu"]
options: ["informal"]
expect:
name: "Pünkösdhétfő"
- given:
date: '2012-08-20'
regions: ["hu"]
options: ["informal"]
expect:
name: "Az államalapítás ünnepe"
- given:
date: '2012-10-23'
regions: ["hu"]
options: ["informal"]
expect:
name: "1956-os forradalom és szabadságharc ünnepe"
- given:
date: '2012-11-01'
regions: ["hu"]
options: ["informal"]
expect:
name: "Mindenszentek"
- given:
date: '2012-12-25'
regions: ["hu"]
options: ["informal"]
expect:
name: "Karácsony"
- given:
date: '2012-12-26'
regions: ["hu"]
options: ["informal"]
expect:
name: "Karácsony"
- given:
date: '2012-03-14'
regions: ["hu"]
expect:
holiday: false
- given:
date: '2016-03-28'
regions: ["hu"]
expect:
name: "Húsvéthétfő"
- given:
date: '2016-03-25'
regions: ["hu"]
expect:
holiday: false
- given:
date: '2017-04-17'
regions: ["hu"]
expect:
name: "Húsvéthétfő"
- given:
date: '2017-04-14'
regions: ["hu"]
expect:
name: "Nagypéntek"

172
vendor/holidays/definitions/ie.yaml vendored Normal file
View File

@ -0,0 +1,172 @@
# Ireland holiday definitions for the Ruby Holiday gem.
#
# Updated: 2012-03-16.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_the_Republic_of_Ireland
# - http://www.citizensinformation.ie/categories/employment/employment-rights-and-conditions/leave-and-holidays/public-holidays-in-ireland
# While there is mention that Jan 2 2012 was not officially a bank holiday, in reality very few businesses will not observe that date as a bank holiday
---
months:
0:
- name: Easter Monday
regions: [ie]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [ie]
mday: 1
observed: to_monday_if_weekend(date)
3:
- name: St. Patrick's Day
regions: [ie]
mday: 17
observed: to_monday_if_weekend(date)
5:
- name: May Day
regions: [ie]
week: 1
wday: 1
6:
- name: June Bank Holiday
regions: [ie]
week: 1
wday: 1
8:
- name: August Bank Holiday
regions: [ie]
week: 1
wday: 1
10:
- name: October Bank Holiday
regions: [ie]
week: -1
wday: 1
12:
- name: Christmas Day
regions: [ie]
mday: 25
observed: to_monday_if_weekend(date)
- name: St. Stephen's Day
regions: [ie]
mday: 26
observed: to_weekday_if_boxing_weekend(date)
tests:
- given:
date: '2008-01-01'
regions: ["ie"]
expect:
name: "New Year's Day"
- given:
date: '2008-03-17'
regions: ["ie"]
expect:
name: "St. Patrick's Day"
- given:
date: '2008-03-24'
regions: ["ie"]
expect:
name: "Easter Monday"
- given:
date: '2008-05-05'
regions: ["ie"]
expect:
name: "May Day"
- given:
date: '2008-06-02'
regions: ["ie"]
expect:
name: "June Bank Holiday"
- given:
date: '2008-08-04'
regions: ["ie"]
expect:
name: "August Bank Holiday"
- given:
date: '2008-10-27'
regions: ["ie"]
expect:
name: "October Bank Holiday"
- given:
date: '2008-12-25'
regions: ["ie"]
expect:
name: "Christmas Day"
- given:
date: '2008-12-26'
regions: ["ie"]
expect:
name: "St. Stephen's Day"
- given:
date: '2012-01-02'
regions: ["ie"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2012-03-19'
regions: ["ie"]
options: ["observed"]
expect:
name: "St. Patrick's Day"
- given:
date: '2012-04-09'
regions: ["ie"]
options: ["observed"]
expect:
name: "Easter Monday"
- given:
date: '2012-05-07'
regions: ["ie"]
options: ["observed"]
expect:
name: "May Day"
- given:
date: '2012-06-04'
regions: ["ie"]
options: ["observed"]
expect:
name: "June Bank Holiday"
- given:
date: '2012-08-06'
regions: ["ie"]
options: ["observed"]
expect:
name: "August Bank Holiday"
- given:
date: '2012-10-29'
regions: ["ie"]
options: ["observed"]
expect:
name: "October Bank Holiday"
- given:
date: '2011-12-26'
regions: ["ie"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2011-12-27'
regions: ["ie"]
options: ["observed"]
expect:
name: "St. Stephen's Day"
- given:
date: '2012-12-25'
regions: ["ie"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2012-12-26'
regions: ["ie"]
options: ["observed"]
expect:
name: "St. Stephen's Day"
- given:
date: '2015-12-28'
regions: ["ie"]
options: ["observed"]
expect:
name: "St. Stephen's Day"

79
vendor/holidays/definitions/index.yaml vendored Normal file
View File

@ -0,0 +1,79 @@
# Definition build list
---
defs:
AR: ['ar.yaml']
AT: ['at.yaml']
AU: ['au.yaml']
BE_FR: ['be_fr.yaml']
BE_NL: ['be_nl.yaml']
BR: ['br.yaml']
BG: ['bg.yaml']
CA: ['ca.yaml', 'northamericainformal.yaml']
CH: ['ch.yaml']
CL: ['cl.yaml']
CO: ['co.yaml']
CR: ['cr.yaml']
CZ: ['cz.yaml']
DK: ['dk.yaml']
DE: ['de.yaml']
ECBTARGET: ['ecbtarget.yaml']
EE: ['ee.yaml']
EL: ['el.yaml']
ES: ['es.yaml']
FederalReserve: ['federalreserve.yaml']
FederalReserveBanks: ['federalreservebanks.yaml']
FedEx: ['fedex.yaml']
FI: ['fi.yaml']
FR: ['fr.yaml']
GB: ['gb.yaml']
GE: ['ge.yaml']
HR: ['hr.yaml']
HK: ['hk.yaml']
HU: ['hu.yaml']
IE: ['ie.yaml']
IS: ['is.yaml']
IT: ['it.yaml']
KR: ['kr.yaml']
KZ: ['kz.yaml']
LI: ['li.yaml']
LT: ['lt.yaml']
LV: ['lv.yaml']
MA: ['ma.yaml']
MT_MT: ['mt_mt.yaml']
MT_EN: ['mt_en.yaml']
MX: ['mx.yaml', 'northamericainformal.yaml']
NERC: ['nerc.yaml']
NL: ['nl.yaml']
LU: ['lu.yaml']
"NO": ['no.yaml']
NYSE: ['nyse.yaml']
NZ: ['nz.yaml']
PE: ['pe.yaml']
PH: ['ph.yaml']
PL: ['pl.yaml']
PT: ['pt.yaml']
RO: ['ro.yaml']
RS_CYRL: ['rs_cyrl.yaml']
RS_LA: ['rs_la.yaml']
RU: ['ru.yaml']
SE: ['se.yaml']
TN: ['tn.yaml']
TR: ['tr.yaml']
UA: ['ua.yaml']
US: ['us.yaml', 'northamericainformal.yaml']
UnitedNations: ['unitednations.yaml']
UPS: ['ups.yaml']
ZA: ['za.yaml']
NorthAmerica: ['ca.yaml', 'mx.yaml', 'us.yaml', 'northamericainformal.yaml']
SouthAmerica: ['ar.yaml', 'br.yaml', 'cl.yaml', 'co.yaml', 'pe.yaml', 've.yaml']
Scandinavia: ['dk.yaml', 'is.yaml', 'no.yaml', 'se.yaml', 'fi.yaml']
Europe: ['at.yaml', 'be_fr.yaml', 'be_nl.yaml', 'ch.yaml', 'cz.yaml', 'dk.yaml', 'de.yaml', 'el.yaml', 'es.yaml', 'fr.yaml', 'gb.yaml', 'hr.yaml', 'hu.yaml', 'ie.yaml', 'is.yaml', 'it.yaml', 'li.yaml', 'lt.yaml', 'lv.yaml', 'nl.yaml', 'no.yaml', 'pl.yaml', 'pt.yaml', 'ro.yaml', 'sk.yaml', 'si.yaml', 'bg.yaml', 'ua.yaml']
JP: ['jp.yaml']
VE: ['ve.yaml']
VI: ['vi.yaml']
SK: ['sk.yaml']
SI: ['si.yaml']
SG: ['sg.yaml']
MY: ['my.yaml']
TH: ['th.yaml']
NG: ['ng.yaml']

247
vendor/holidays/definitions/is.yaml vendored Normal file
View File

@ -0,0 +1,247 @@
# Icelandic holiday definitions for the Ruby Holiday gem.
#
# Updated: 2008-11-29.
# Sources:
# - http://www.simnet.is/gardarj/folk/days.htm#days
# - http://www.iceland.is/history-and-culture/Traditions/IcelandicHolidays/
# - http://en.wikipedia.org/wiki/Public_holidays_in_Iceland
# - http://www.qppstudio.net/publicholidays2007/iceland.htm
---
months:
0:
- name: Bolludagur
regions: [is]
function: easter(year)
function_modifier: -48
- name: Sprengidagur
regions: [is]
function: easter(year)
function_modifier: -47
- name: Öskudagur
regions: [is]
function: easter(year)
function_modifier: -46
- name: Pálmasunnudagur
regions: [is]
function: easter(year)
function_modifier: -7
- name: Skírdagur
regions: [is]
function: easter(year)
function_modifier: -3
- name: Föstudaginn langi
regions: [is]
function: easter(year)
function_modifier: -2
- name: Páskadagur
regions: [is]
function: easter(year)
- name: Annar í páskum
regions: [is]
function: easter(year)
function_modifier: 1
- name: Uppstigningardagur
regions: [is]
function: easter(year)
function_modifier: 39
- name: Hvítasunnudagur
regions: [is]
function: easter(year)
function_modifier: 49
- name: Annar í hvítasunnu
regions: [is]
function: easter(year)
function_modifier: 50
1:
- name: Nýársdagur
regions: [is]
mday: 1
- name: Þrettándinn
regions: [is]
mday: 6
- name: Bóndadagur
regions: [is]
mday: 19
type: informal
2:
- name: Konudagur
regions: [is]
mday: 18
type: informal
4:
- name: Sumardagurinn fyrsti
regions: [is]
function: is_sumardagurinn_fyrsti(year)
5:
- name: Verkalýðsdagurinn
regions: [is]
mday: 1
- name: Mæðradagurinn
regions: [is]
mday: 13
6:
- name: Sjómannadagurinn
regions: [is]
mday: 3
type: informal
- name: Lýðveldisdagurinn
regions: [is]
mday: 17
8:
- name: Frídagur verslunarmanna
regions: [is]
week: 1
wday: 1
11:
- name: Dagur íslenskrar tungu
regions: [is]
mday: 16
12:
- name: Jól
regions: [is]
mday: 24
- name: Jól
regions: [is]
mday: 25
- name: Jól
regions: [is]
mday: 26
- name: Gamlárskvöld
regions: [is]
mday: 31
methods:
is_sumardagurinn_fyrsti:
# Iceland: first day of summer (Thursday after 18 April)
arguments: year
ruby: |
date = Date.civil(year,4,18)
if date.wday < 4
date += (4 - date.wday)
else
date += (11 - date.wday)
end
date
tests:
- given:
date: '2007-01-01'
regions: ["is"]
options: ["informal"]
expect:
name: "Nýársdagur"
- given:
date: '2007-01-06'
regions: ["is"]
options: ["informal"]
expect:
name: "Þrettándinn"
- given:
date: '2007-01-19'
regions: ["is"]
options: ["informal"]
expect:
name: "Bóndadagur"
- given:
date: '2007-02-18'
regions: ["is"]
options: ["informal"]
expect:
name: "Konudagur"
- given:
date: '2007-04-05'
regions: ["is"]
options: ["informal"]
expect:
name: "Skírdagur"
- given:
date: '2007-04-06'
regions: ["is"]
options: ["informal"]
expect:
name: "Föstudaginn langi"
- given:
date: '2007-04-08'
regions: ["is"]
options: ["informal"]
expect:
name: "Páskadagur"
- given:
date: '2007-04-09'
regions: ["is"]
options: ["informal"]
expect:
name: "Annar í páskum"
- given:
date: '2007-04-19'
regions: ["is"]
options: ["informal"]
expect:
name: "Sumardagurinn fyrsti"
- given:
date: '2007-05-01'
regions: ["is"]
options: ["informal"]
expect:
name: "Verkalýðsdagurinn"
- given:
date: '2007-05-17'
regions: ["is"]
options: ["informal"]
expect:
name: "Uppstigningardagur"
- given:
date: '2007-05-27'
regions: ["is"]
options: ["informal"]
expect:
name: "Hvítasunnudagur"
- given:
date: '2007-05-28'
regions: ["is"]
options: ["informal"]
expect:
name: "Annar í hvítasunnu"
- given:
date: '2007-06-03'
regions: ["is"]
options: ["informal"]
expect:
name: "Sjómannadagurinn"
- given:
date: '2007-06-17'
regions: ["is"]
options: ["informal"]
expect:
name: "Lýðveldisdagurinn"
- given:
date: '2007-08-06'
regions: ["is"]
options: ["informal"]
expect:
name: "Frídagur verslunarmanna"
- given:
date: '2007-12-24'
regions: ["is"]
options: ["informal"]
expect:
name: "Jól"
- given:
date: '2007-12-25'
regions: ["is"]
options: ["informal"]
expect:
name: "Jól"
- given:
date: '2007-12-26'
regions: ["is"]
options: ["informal"]
expect:
name: "Jól"
- given:
date: '2007-12-31'
regions: ["is"]
options: ["informal"]
expect:
name: "Gamlárskvöld"

246
vendor/holidays/definitions/it.yaml vendored Normal file
View File

@ -0,0 +1,246 @@
# Italian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2008-11-23.
# Sources:
# - http://en.wikipedia.org/wiki/Holidays_in_Italy
#
# Changes 2019-03-11
# - add Rome region (it_rm)
# - add Festa di San Pietro e Paolo for it_rm region
#
# Sources:
# - https://en.wikipedia.org/wiki/Feast_of_Saints_Peter_and_Paul
# - https://www.officeholidays.com/countries/global/st_peter_and_paul.php
#
# Changes 2019-06-28
# - add Florence region (it_fi)
# - add Genoa region (it_ge)
# - add Turin region (it_to)
# - add Festa di San Giovanni Battista for it_fi, it_ge, it_to regions
# Sources:
# - https://www.officeholidays.com/holidays/italy/st-johns-day
#
# Changes 2019-09-18
# - add Venetian regions (it_vr, it_vi, it_pd, it_ro, it_tv, it_bl, it_ve)
# - add patron's feast for each venetian region
# Sources:
# - https://it.wikipedia.org/wiki/Santi_patroni_cattolici_delle_citt%C3%A0_capoluogo_di_provincia_italiane
---
months:
0:
- name: Pasqua
regions: [it]
function: easter(year)
- name: Lunedì dell'Angelo
regions: [it]
function: easter(year)
function_modifier: 1
1:
- name: Capodanno
regions: [it]
mday: 1
- name: Epifania
regions: [it]
mday: 6
4:
- name: Festa della Liberazione
regions: [it]
mday: 25
- name: Festa di San Marco Evangelista
regions: [it_ve]
mday: 25
- name: Festa di San Liberale
regions: [it_tv]
mday: 27
5:
- name: Festa dei Lavoratori
regions: [it]
mday: 1
- name: Festa di San Zeno
regions: [it_vr]
mday: 21
6:
- name: Festa della Repubblica
regions: [it]
mday: 2
- name: Festa di Sant'Antonio di Padova
regions: [it_pd]
mday: 13
- name: Festa di San Giovanni Battista
regions: [it_fi, it_ge, it_to]
mday: 24
- name: Festa di San Pietro e Paolo
regions: [it_rm]
mday: 29
8:
- name: Assunzione
regions: [it]
mday: 15
9:
- name: Festa della Madonna di Monte Berico
regions: [it_vi]
mday: 8
11:
- name: Ognissanti
regions: [it]
mday: 1
- name: Festa di San Martino
regions: [it_bl]
mday: 11
- name: Festa di San Bellino
regions: [it_ro]
mday: 26
12:
- name: Immacolata Concezione
regions: [it]
mday: 8
- name: Natale
regions: [it]
mday: 25
- name: Santo Stefano
regions: [it]
mday: 26
tests:
- given:
date: '2007-01-01'
regions: ["it"]
options: ["informal"]
expect:
name: "Capodanno"
- given:
date: '2007-01-06'
regions: ["it"]
options: ["informal"]
expect:
name: "Epifania"
- given:
date: '2007-04-08'
regions: ["it"]
options: ["informal"]
expect:
name: "Pasqua"
- given:
date: '2007-04-09'
regions: ["it"]
options: ["informal"]
expect:
name: "Lunedì dell'Angelo"
- given:
date: '2007-04-25'
regions: ["it"]
options: ["informal"]
expect:
name: "Festa della Liberazione"
# This is a valid test but unfortunately we have no way right now to handle two holidays that occur on the same day in tests.
# Allowing for it will require some kind of update to the test def here to say 'I expect this to be the second result returned'
# and this will require ruby updates.
#
#- given:
# date: '2019-04-25'
# regions: ["it_ve"]
# options: ["informal"]
# expect:
# name: "Festa di San Marco Evangelista"
- given:
date: '2019-04-27'
regions: ["it_tv"]
options: ["informal"]
expect:
name: "Festa di San Liberale"
- given:
date: '2007-05-01'
regions: ["it"]
options: ["informal"]
expect:
name: "Festa dei Lavoratori"
- given:
date: '2019-05-21'
regions: ["it_vr"]
options: ["informal"]
expect:
name: "Festa di San Zeno"
- given:
date: '2007-06-02'
regions: ["it"]
options: ["informal"]
expect:
name: "Festa della Repubblica"
- given:
date: '2019-06-13'
regions: ["it_pd"]
options: ["informal"]
expect:
name: "Festa di Sant'Antonio di Padova"
- given:
date: '2019-06-24'
regions: ["it_fi", "it_ge", "it_to"]
options: ["informal"]
expect:
name: "Festa di San Giovanni Battista"
- given:
date: '2019-06-24'
regions: ["it"]
expect:
holiday: false
- given:
date: '2019-06-29'
regions: ["it_rm"]
options: ["informal"]
expect:
name: "Festa di San Pietro e Paolo"
- given:
date: '2019-06-29'
regions: ["it"]
expect:
holiday: false
- given:
date: '2007-08-15'
regions: ["it"]
options: ["informal"]
expect:
name: "Assunzione"
- given:
date: '2019-09-08'
regions: ["it_vi"]
options: ["informal"]
expect:
name: "Festa della Madonna di Monte Berico"
- given:
date: '2007-11-01'
regions: ["it"]
options: ["informal"]
expect:
name: "Ognissanti"
- given:
date: '2019-11-11'
regions: ["it_bl"]
options: ["informal"]
expect:
name: "Festa di San Martino"
- given:
date: '2019-11-26'
regions: ["it_ro"]
options: ["informal"]
expect:
name: "Festa di San Bellino"
- given:
date: '2007-12-08'
regions: ["it"]
options: ["informal"]
expect:
name: "Immacolata Concezione"
- given:
date: '2007-12-25'
regions: ["it"]
options: ["informal"]
expect:
name: "Natale"
- given:
date: '2007-12-26'
regions: ["it"]
options: ["informal"]
expect:
name: "Santo Stefano"

761
vendor/holidays/definitions/jp.yaml vendored Normal file
View File

@ -0,0 +1,761 @@
# Japanese holiday definitions for Ruby Holiday gem.
# Reference:
# - http://www.h3.dion.ne.jp/~sakatsu/holiday_topic.htm
# - http://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html
# - https://en.wikipedia.org/wiki/Public_holidays_in_Japan
#
# For Japanese/English translations of each holiday:
# - https://kotoritone.com/japanesecalendar/holidays/2019/
#
# This definition can calculate current Japanese holidays,
# don't compat with past changes of Japan Holiday Act.
#
# CHANGES:
# 2010-12-25: Initial version by Tatsuki Sugiura <sugi@nemui.org>
# 2014-11-09: Added substitute holiday by Yoshiyuki Hirano <yoshiyuki.hirano@henteco-labs.com>
# 2015-05-10: Non-Monday substitute holidays by Shuhei Kagawa <shuhei.kagawa@gmail.com>
# 2015-12-15: Added mountain day by Tsuyoshi Sano <ttwo32@gmail.com>
# 2016-03-26: Updated to match new custom method signature. See below for more. Phil Trimble <philtrimble@gmail.com>
# 2019-02-10: Changing usage of 'year_ranges.after' to 'year_ranges.from' and 'year_ranges.before' to 'year_ranges.until', see https://github.com/holidays/definitions/issues/117
#
# MAINTAINER NOTE: This is the most complex set of custom date methods in the entire
# project, mainly surrounding the idea of 'substitute' holidays. Since this is
# the only one that is this complex I have settled on a less-than-ideal solution.
# It is overly verbose and not easy to follow. It will be a target for refactoring
# in the near future.
---
months:
1:
- name: 元日
regions: [jp]
mday: 1
- name: 成人の日
regions: [jp]
wday: 1
week: 2
- name: 振替休日
regions: [jp]
mday: 1
function: jp_substitute_holiday(year, month, day)
2:
- name: 建国記念の日
regions: [jp]
mday: 11
- name: 振替休日
regions: [jp]
mday: 11
function: jp_substitute_holiday(year, month, day)
- name: 天皇誕生日
regions: [jp]
mday: 23
year_ranges:
from: 2020
- name: 振替休日
regions: [jp]
mday: 23
function: jp_substitute_holiday(year, month, day)
year_ranges:
from: 2020
3:
- name: 春分の日
regions: [jp]
function: jp_vernal_equinox_day(year)
- name: 振替休日
regions: [jp]
function: jp_vernal_equinox_day_substitute(year)
4:
- name: 昭和の日
regions: [jp]
mday: 29
- name: 振替休日
regions: [jp]
mday: 29
function: jp_substitute_holiday(year, month, day)
- name: 休日
regions: [jp]
mday: 30
year_ranges:
limited: [2019]
5:
- name: 天皇即位
regions: [jp]
mday: 1
year_ranges:
limited: [2019]
- name: 休日
regions: [jp]
mday: 2
year_ranges:
limited: [2019]
- name: 憲法記念日
regions: [jp]
mday: 3
- name: みどりの日
regions: [jp]
mday: 4
- name: こどもの日
regions: [jp]
mday: 5
- name: 振替休日
regions: [jp]
mday: 3
function: jp_substitute_holiday(year, month, day)
- name: 振替休日
regions: [jp]
mday: 4
function: jp_substitute_holiday(year, month, day)
- name: 振替休日
regions: [jp]
mday: 5
function: jp_substitute_holiday(year, month, day)
7:
- name: 海の日
regions: [jp]
mday: 20
year_ranges:
between:
start: 1996
end: 2002
- name: 海の日
regions: [jp]
wday: 1
week: 3
year_ranges:
between:
start: 2003
end: 2019
- name: 海の日
regions: [jp]
mday: 23
year_ranges:
limited: [2020]
- name: 海の日
regions: [jp]
mday: 22
year_ranges:
limited: [2021]
- name: 海の日
regions: [jp]
wday: 1
week: 3
year_ranges:
from: 2022
- name: 振替休日
regions: [jp]
function: jp_marine_day_substitute(year)
year_ranges:
between:
start: 1996
end: 2002
- name: スポーツの日
regions: [jp]
mday: 23
year_ranges:
limited: [2021]
- name: スポーツの日
regions: [jp]
mday: 24
year_ranges:
limited: [2020]
8:
- name: 山の日
regions: [jp]
year_ranges:
between:
start: 2016
end: 2019
function: jp_mountain_holiday(year)
- name: 山の日
regions: [jp]
mday: 10
year_ranges:
limited: [2020]
- name: 山の日
regions: [jp]
mday: 8
year_ranges:
limited: [2021]
- name: 山の日
regions: [jp]
year_ranges:
from: 2022
function: jp_mountain_holiday(year)
- name: 振替休日
regions: [jp]
year_ranges:
between:
start: 2016
end: 2020
function: jp_mountain_holiday_substitute(year)
- name: 振替休日
regions: [jp]
mday: 9
year_ranges:
limited: [2021]
- name: 振替休日
regions: [jp]
year_ranges:
from: 2022
function: jp_mountain_holiday_substitute(year)
9:
- name: 敬老の日
regions: [jp]
wday: 1
week: 3
- name: 振替休日
regions: [jp]
function: jp_respect_for_aged_holiday_substitute(year)
- name: 国民の休日
regions: [jp]
year_ranges:
from: 2003
function: jp_citizens_holiday(year)
- name: 秋分の日
regions: [jp]
function: jp_national_culture_day(year)
- name: 振替休日
regions: [jp]
function: jp_national_culture_day_substitute(year)
10:
- name: 体育の日
regions: [jp]
wday: 1
week: 2
year_ranges:
until: 2019
- name: スポーツの日
regions: [jp]
wday: 1
week: 2
year_ranges:
from: 2022
- name: 振替休日
regions: [jp]
function: jp_health_sports_day_substitute(year)
- name: 即位礼正殿の儀
regions: [jp]
mday: 22
year_ranges:
limited: [2019]
11:
- name: 文化の日
regions: [jp]
mday: 3
- name: 振替休日
regions: [jp]
mday: 3
function: jp_substitute_holiday(year, month, day)
- name: 勤労感謝の日
regions: [jp]
mday: 23
- name: 振替休日
regions: [jp]
mday: 23
function: jp_substitute_holiday(year, month, day)
12:
- name: 天皇誕生日
regions: [jp]
mday: 23
year_ranges:
until: 2018
- name: 振替休日
regions: [jp]
mday: 23
function: jp_substitute_holiday(year, month, day)
year_ranges:
until: 2018
methods:
jp_health_sports_day_substitute:
arguments: year
ruby: |
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 10, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 10, 2, 1))
jp_vernal_equinox_day:
arguments: year
ruby: |
day =
case year
when 1851..1899
19.8277
when 1900..1979
20.8357
when 1980..2099
20.8431
when 2100..2150
21.8510
else
raise IndexError.new("Out of range")
end
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
day = day.floor
Date.civil(year, 3, day)
jp_vernal_equinox_day_substitute:
arguments: year
ruby: |
date = Holidays::Factory::Definition.custom_methods_repository.find("jp_vernal_equinox_day(year)").call(year)
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
jp_marine_day_substitute:
arguments: year
ruby: |
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 7, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 7, 3, 1))
jp_national_culture_day:
arguments: year
ruby: |
day =
case year
when 1851..1899
22.2588
when 1900..1979
23.2588
when 1980..2099
23.2488
when 2100..2150
24.2488
else
raise IndexError.new("Out of range")
end
day += 0.242194 * (year - 1980) - ((year - 1980)/4).floor
day = day.floor
Date.civil(year, 9, day)
jp_national_culture_day_substitute:
arguments: year
ruby: |
date = Holidays::Factory::Definition.custom_methods_repository.find("jp_national_culture_day(year)").call(year)
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
jp_citizens_holiday:
arguments: year
ruby: |
ncd = Holidays::Factory::Definition.custom_methods_repository.find("jp_national_culture_day(year)").call(year)
if ncd.wday == 3
ncd - 1
else
nil
end
jp_mountain_holiday:
arguments: year
ruby: |
Date.civil(year, 8, 11)
jp_mountain_holiday_substitute:
arguments: year
ruby: |
date = Holidays::Factory::Definition.custom_methods_repository.find("jp_mountain_holiday(year)").call(year)
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, date.month, date.mday)
jp_respect_for_aged_holiday_substitute:
arguments: year
ruby: |
Holidays::Factory::Definition.custom_methods_repository.find("jp_substitute_holiday(year, month, day)").call(year, 9, Holidays::Factory::DateCalculator.day_of_month_calculator.call(year, 9, 3, 1))
jp_substitute_holiday:
arguments: year, month, day
ruby: |
date = Date.civil(year, month, day)
date.wday == 0 ? (Holidays::Factory::Definition.custom_methods_repository.find("jp_next_weekday(date)").call(date+1)) : nil
jp_next_weekday:
arguments: date
ruby: |
# This suuuucks. I have no idea how to make this not reach into our interal ruby API to do this.
# I'm punting, I'll come back to this.
is_holiday = Holidays::JP.holidays_by_month[date.month].any? do |holiday|
holiday[:mday] == date.day
end
date.wday == 0 || is_holiday ? (Holidays::Factory::Definition.custom_methods_repository.find("jp_next_weekday(date)").call(date+1)) : date
tests:
- given:
date: '2008-01-01'
regions: ["jp"]
options: ["informal"]
expect:
name: "元日"
- given:
date: '2010-01-11'
regions: ["jp"]
options: ["informal"]
expect:
name: "成人の日"
- given:
date: '2008-02-11'
regions: ["jp"]
options: ["informal"]
expect:
name: "建国記念の日"
- given:
date: '2008-04-29'
regions: ["jp"]
options: ["informal"]
expect:
name: "昭和の日"
- given:
date: '2008-05-03'
regions: ["jp"]
options: ["informal"]
expect:
name: "憲法記念日"
- given:
date: '2008-05-05'
regions: ["jp"]
options: ["informal"]
expect:
name: "こどもの日"
- given:
date: '2010-07-19'
regions: ["jp"]
options: ["informal"]
expect:
name: "海の日"
- given:
date: '2010-09-20'
regions: ["jp"]
options: ["informal"]
expect:
name: "敬老の日"
- given:
date: '2010-10-11'
regions: ["jp"]
options: ["informal"]
expect:
name: "体育の日"
- given:
date: '2008-11-03'
regions: ["jp"]
options: ["informal"]
expect:
name: "文化の日"
- given:
date: '2008-11-23'
regions: ["jp"]
options: ["informal"]
expect:
name: "勤労感謝の日"
- given:
date: '2008-12-23'
regions: ["jp"]
options: ["informal"]
expect:
name: "天皇誕生日"
- given:
date: '2010-03-22'
regions: ["jp"]
options: ["informal"]
expect:
name: "振替休日"
- given:
date: '2008-11-24'
regions: ["jp"]
options: ["informal"]
expect:
name: "振替休日"
- given:
date: '2012-01-02'
regions: ["jp"]
options: ["informal"]
expect:
name: "振替休日"
- given:
date: '2013-05-06'
regions: ["jp"]
options: ["informal"]
expect:
name: "振替休日"
- given:
date: '2014-05-06'
regions: ["jp"]
options: ["informal"]
expect:
name: "振替休日"
- given:
date: '2015-05-06'
regions: ["jp"]
options: ["informal"]
expect:
name: "振替休日"
- given:
date: '2019-08-12'
regions: ["jp"]
options: ["informal"]
expect:
name: "振替休日"
- given:
date: '2004-03-20'
regions: ["jp"]
expect:
name: "春分の日"
- given:
date: '2005-03-20'
regions: ["jp"]
expect:
name: "春分の日"
- given:
date: '2006-03-21'
regions: ["jp"]
expect:
name: "春分の日"
- given:
date: '2007-03-21'
regions: ["jp"]
expect:
name: "春分の日"
- given:
date: '2008-03-20'
regions: ["jp"]
expect:
name: "春分の日"
- given:
date: '2009-03-20'
regions: ["jp"]
expect:
name: "春分の日"
- given:
date: '2010-03-21'
regions: ["jp"]
expect:
name: "春分の日"
- given:
date: '2004-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2005-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2006-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2007-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2008-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2009-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2010-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2011-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2012-09-22'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2013-09-23'
regions: ["jp"]
expect:
name: "秋分の日"
- given:
date: '2032-09-21'
regions: ["jp"]
expect:
name: "国民の休日"
- given:
date: '2049-09-21'
regions: ["jp"]
expect:
name: "国民の休日"
- given:
date: '2009-09-22'
regions: ["jp"]
expect:
name: "国民の休日"
- given:
date: '2015-09-22'
regions: ["jp"]
expect:
name: "国民の休日"
- given:
date: '2026-09-22'
regions: ["jp"]
expect:
name: "国民の休日"
- given:
date: '1996-07-20'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2002-07-20'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2003-07-21'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2004-07-19'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2005-07-18'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2006-07-17'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2007-07-16'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2009-07-20'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2013-07-15'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2014-07-21'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2019-07-15'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2020-07-20'
regions: ["jp"]
expect:
holiday: false
- given:
date: '2020-07-23'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2021-07-22'
regions: ["jp"]
expect:
name: "海の日"
- given:
date: '2016-08-11'
regions: ["jp"]
expect:
name: "山の日"
- given:
date: '2017-08-11'
regions: ["jp"]
expect:
name: "山の日"
- given:
date: '2018-08-11'
regions: ["jp"]
expect:
name: "山の日"
- given:
date: '2019-08-11'
regions: ["jp"]
expect:
name: "山の日"
- given:
date: '2020-08-10'
regions: ["jp"]
expect:
name: "山の日"
- given:
date: '2020-08-11'
regions: ["jp"]
expect:
holiday: false
- given:
date: '2021-08-08'
regions: ["jp"]
expect:
name: "山の日"
- given:
date: '2021-08-09'
regions: ["jp"]
expect:
name: "振替休日"
- given:
date: '2022-08-11'
regions: ["jp"]
expect:
name: "山の日"
- given:
date: '2015-08-11'
regions: ["jp"]
expect:
holiday: false
- given:
date: '1998-09-22'
regions: ["jp"]
expect:
holiday: false
- given:
date: '2018-12-23'
regions: ["jp"]
expect:
name: "天皇誕生日"
- given:
date: '2019-02-23'
regions: ["jp"]
expect:
holiday: false
- given:
date: '2019-12-23'
regions: ["jp"]
expect:
holiday: false
- given:
date: '2020-02-23'
regions: ["jp"]
expect:
name: "天皇誕生日"
- given:
date: '2019-10-14'
regions: ["jp"]
expect:
name: "体育の日"
- given:
date: '2020-07-24'
regions: ["jp"]
expect:
name: "スポーツの日"
- given:
date: '2020-10-12'
regions: ["jp"]
expect:
holiday: false
- given:
date: '2021-07-23'
regions: ["jp"]
expect:
name: "スポーツの日"

166
vendor/holidays/definitions/kr.yaml vendored Normal file
View File

@ -0,0 +1,166 @@
# Republic of Korea holiday definitions for the Ruby Holiday gem.
# Provided by Jonathan Pike
#
# Updated: 2017-08-09.
# Sources:
# - https://en.wikipedia.org/wiki/List_of_public_holidays_in_South_Korea
# - http://www.hko.gov.hk/gts/time/conversion.htm (for Lunar Calendar Conversions)
#
# For Korean/English translations of each holiday:
# - https://ko.wikipedia.org/wiki/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD%EC%9D%98_%EA%B3%B5%ED%9C%B4%EC%9D%BC
---
months:
1:
- name: 설날
regions: [kr]
function: lunar_to_solar(year, month, day, region)
mday: 1
- name: 설날 연휴
regions: [kr]
function: lunar_to_solar(year, month, day, region)
mday: 2
- name: 신정
regions: [kr]
mday: 1
3:
- name: 3·1절
regions: [kr]
mday: 1
4:
- name: 석가탄신일
regions: [kr]
function: lunar_to_solar(year, month, day, region)
mday: 8
5:
- name: 어린이날
regions: [kr]
mday: 5
6:
- name: 현충일
regions: [kr]
mday: 6
7:
- name: 제헌절
regions: [kr]
mday: 17
type: informal
8:
- name: 추석 연휴
regions: [kr]
function: lunar_to_solar(year, month, day, region)
mday: 14
- name: 추석
regions: [kr]
function: lunar_to_solar(year, month, day, region)
mday: 15
- name: 추석 연휴
regions: [kr]
function: lunar_to_solar(year, month, day, region)
mday: 16
- name: 광복절
regions: [kr]
mday: 15
10:
- name: 개천절
regions: [kr]
mday: 3
- name: 한글날
regions: [kr]
mday: 9
12:
- name: 크리스마스
regions: [kr]
mday: 25
- name: 설날 연휴
regions: [kr]
function: lunar_to_solar(year, month, day, region)
mday: 30
tests:
- given:
date: '2016-02-08'
regions: ["kr"]
options: ["informal"]
expect:
name: "설날"
- given:
date: '2017-01-29'
regions: ["kr"]
options: ["informal"]
expect:
name: "설날 연휴"
- given:
date: '2016-05-14'
regions: ["kr"]
options: ["informal"]
expect:
name: "석가탄신일"
- given:
date: '2016-09-15'
regions: ["kr"]
options: ["informal"]
expect:
name: "추석"
- given:
date: '2016-03-01'
regions: ["kr"]
options: ["informal"]
expect:
name: "3·1절"
- given:
date: '2016-05-05'
regions: ["kr"]
options: ["informal"]
expect:
name: "어린이날"
- given:
date: '2016-06-06'
regions: ["kr"]
options: ["informal"]
expect:
name: "현충일"
- given:
date: '2016-07-17'
regions: ["kr"]
options: ["informal"]
expect:
name: "제헌절"
- given:
date: '2016-08-15'
regions: ["kr"]
options: ["informal"]
expect:
name: "광복절"
- given:
date: '2016-10-03'
regions: ["kr"]
options: ["informal"]
expect:
name: "개천절"
- given:
date: '2016-10-09'
regions: ["kr"]
options: ["informal"]
expect:
name: "한글날"
- given:
date: '2016-12-25'
regions: ["kr"]
options: ["informal"]
expect:
name: "크리스마스"
- given:
date: '2017-01-28'
regions: ["kr"]
options: ["informal"]
expect:
name: "설날"
# These are commented out until I can have a discussion and better understand these holidays.
# Please see [issue 69](https://github.com/holidays/definitions/issues/69) (nice) for more information.
# - given:
# date: '2017-10-04'
# regions: ["kr"]
# options: ["informal"]
# expect:
# name: "추석"

128
vendor/holidays/definitions/kz.yaml vendored Normal file
View File

@ -0,0 +1,128 @@
# Kazakh holiday definitions for the Ruby Holiday gem.
#
# Created: 2020-09-18
# Sources:
# - https://www.officeholidays.com/countries/kazakhstan/2020
# - https://en.wikipedia.org/wiki/Public_holidays_in_Kazakhstan
---
months:
1:
- name: Jańa jyl # New Year's Day
regions: [kz]
mday: 1
- name: Jańa jyl # 1st New Year holiday
regions: [kz]
mday: 2
3:
- name: Halyqaralyq áıelder kúni # International Women's Day
regions: [kz]
mday: 8
- name: Naýryz Meıramy # Nauryz
regions: [kz]
mday: 21
- name: Naýryz Meıramy # Nauryz
regions: [kz]
mday: 22
- name: Naýryz Meıramy # Nauryz
regions: [kz]
mday: 23
5:
- name: Qazaqstan halqynyń birligi merekesi # Kazakhstan People's Unity Day
regions: [kz]
mday: 1
- name: Otan Qorǵaýshy kuni # Defender of the Fatherland day
regions: [kz]
mday: 7
- name: Jeńis kúni # Victory Day
regions: [kz]
mday: 9
7:
- name: Astana kúni # Capital Day
regions: [kz]
mday: 6
8:
- name: Qazaqstan Respýblıkasynyń Konstıtýcıyasy kúni # Constitution day
regions: [kz]
mday: 30
12:
- name: Túńǵysh Prezıdent kúni # First President Day
regions: [kz]
mday: 1
- name: Táýelsizdik kúni # Independence day
regions: [kz]
mday: 16
- name: Táýelsizdik kúni # Independence day
regions: [kz]
mday: 17
tests:
- given:
date: ['2020-1-1']
regions: ["kz"]
expect:
name: "Jańa jyl"
- given:
date: ['2020-1-2']
regions: ["kz"]
expect:
name: "Jańa jyl"
- given:
date: '2020-3-8'
regions: ["kz"]
expect:
name: "Halyqaralyq áıelder kúni"
- given:
date: '2020-3-21'
regions: ["kz"]
expect:
name: "Naýryz Meıramy"
- given:
date: '2020-3-22'
regions: ["kz"]
expect:
name: "Naýryz Meıramy"
- given:
date: '2020-3-23'
regions: ["kz"]
expect:
name: "Naýryz Meıramy"
- given:
date: '2020-5-1'
regions: ["kz"]
expect:
name: "Qazaqstan halqynyń birligi merekesi"
- given:
date: '2020-5-7'
regions: ["kz"]
expect:
name: "Otan Qorǵaýshy kuni"
- given:
date: '2020-5-9'
regions: ["kz"]
expect:
name: "Jeńis kúni"
- given:
date: '2020-7-6'
regions: ["kz"]
expect:
name: "Astana kúni"
- given:
date: '2020-8-30'
regions: ["kz"]
expect:
name: "Qazaqstan Respýblıkasynyń Konstıtýcıyasy kúni"
- given:
date: '2020-12-1'
regions: ["kz"]
expect:
name: "Túńǵysh Prezıdent kúni"
- given:
date: '2020-12-16'
regions: ["kz"]
expect:
name: "Táýelsizdik kúni"
- given:
date: '2020-12-17'
regions: ["kz"]
expect:
name: "Táýelsizdik kúni"

154
vendor/holidays/definitions/li.yaml vendored Normal file
View File

@ -0,0 +1,154 @@
# Liechtenstein holiday definitions for the Ruby Holiday gem.
#
# Updated: 2011-10-17.
# Sources:
# http://www.tourismus.li/de/navpage-RegionLI-InformationLI-44728.html
---
months:
0:
- name: Fasnachtsdienstag
regions: [li]
function: easter(year)
function_modifier: -47
- name: Karfreitag
regions: [li]
function: easter(year)
function_modifier: -2
- name: Ostern
regions: [li]
function: easter(year)
type: informal
- name: Ostermontag
regions: [li]
function: easter(year)
function_modifier: 1
- name: Auffahrt
regions: [li]
function: easter(year)
function_modifier: 39
- name: Pfingstmontag
regions: [li]
function: easter(year)
function_modifier: 50
- name: Fronleichnam
regions: [li]
function: easter(year)
function_modifier: 60
1:
- name: Neujahrstag
regions: [li]
mday: 1
- name: Heilige Drei Könige
regions: [li, li]
mday: 6
2:
- name: Maria Lichtmess
regions: [li]
mday: 2
3:
- name: St. Josef
regions: [li]
mday: 19
5:
- name: Tag der Arbeit
regions: [li]
mday: 1
8:
- name: Staatsfeiertag
regions: [li]
mday: 15
9:
- name: Maria Geburt
regions: [li]
mday: 8
11:
- name: Allerheiligen
regions: [li]
mday: 1
12:
- name: Maria Empfängnis
regions: [li]
mday: 8
- name: Heilig Abend
regions: [li]
mday: 24
- name: Weihnachten
regions: [li]
mday: 25
- name: Stefanstag
regions: [li]
mday: 26
- name: Silvester
regions: [li]
mday: 31
tests:
- given:
date: '2009-01-01'
regions: ["li"]
options: ["informal"]
expect:
name: "Neujahrstag"
- given:
date: '2011-03-08'
regions: ["li"]
options: ["informal"]
expect:
name: "Fasnachtsdienstag"
- given:
date: '2009-04-10'
regions: ["li"]
options: ["informal"]
expect:
name: "Karfreitag"
- given:
date: '2009-04-12'
regions: ["li"]
options: ["informal"]
expect:
name: "Ostern"
- given:
date: '2009-04-13'
regions: ["li"]
options: ["informal"]
expect:
name: "Ostermontag"
- given:
date: '2009-05-21'
regions: ["li"]
options: ["informal"]
expect:
name: "Auffahrt"
- given:
date: '2009-06-01'
regions: ["li"]
options: ["informal"]
expect:
name: "Pfingstmontag"
- given:
date: '2009-12-25'
regions: ["li"]
options: ["informal"]
expect:
name: "Weihnachten"
- given:
date: '2009-12-26'
regions: ["li"]
options: ["informal"]
expect:
name: "Stefanstag"
- given:
date: '2009-06-11'
regions: ["li"]
expect:
name: "Fronleichnam"
- given:
date: '2009-08-15'
regions: ["li"]
expect:
name: "Staatsfeiertag"
- given:
date: '2009-11-01'
regions: ["li"]
expect:
name: "Allerheiligen"

View File

@ -0,0 +1,38 @@
require_relative 'error'
module Definitions
module Validation
class CustomMethod
VALID_ARGUMENTS = ["date", "year", "month", "day"]
def call(methods)
methods.each do |name, method|
raise Errors::InvalidCustomMethod unless
valid_name?(name) &&
valid_arguments?(method['arguments']) &&
valid_source?(method['ruby'])
end
true
end
private
def valid_name?(name)
!name.nil? && !name.empty?
end
def valid_arguments?(arguments)
!arguments.nil? &&
!arguments.empty? &&
arguments.split(",").all? { |arg|
arg == arg.chomp && VALID_ARGUMENTS.include?(arg.strip)
}
end
def valid_source?(source)
!source.nil? && !source.empty?
end
end
end
end

View File

@ -0,0 +1,35 @@
require_relative 'error'
module Definitions
module Validation
class Definition
def initialize(custom_method_validator, months_validator, test_validator)
@custom_method_validator = custom_method_validator
@months_validator = months_validator
@test_validator = test_validator
end
def call(definition)
validate_months!(definition['months'])
validate_methods!(definition['methods'])
validate_tests!(definition['tests'])
true
end
private
def validate_months!(months)
@months_validator.call(months)
end
def validate_methods!(methods)
@custom_method_validator.call(methods) unless methods.nil?
end
def validate_tests!(tests)
@test_validator.call(tests) unless tests.nil?
end
end
end
end

View File

@ -0,0 +1,11 @@
module Definitions
module Errors
class Error < StandardError; end
class NoMonths < Error ; end
class InvalidMonth < Error; end
class InvalidMethod < Error; end
class InvalidRegions < Error; end
class InvalidCustomMethod < Error; end
class InvalidTest < Error; end
end
end

View File

@ -0,0 +1,58 @@
require_relative 'error'
module Definitions
module Validation
class Month
def call(months)
raise Errors::NoMonths.new("Months is required, received: '#{months}'") if months.nil? || months.empty?
months.each do |month, month_defs|
raise Errors::InvalidMonth.new("All months must be an integer, received: #{months}") unless month.is_a?(Integer)
raise Errors::InvalidMonth.new("All months must be between 0 and 12, received: #{months}") if month < 0 || month > 12
month_defs.each do |month_def|
raise Errors::InvalidMonth.new("All months must have a name, received: #{months}") if month_def['name'].nil? || month_def['name'].empty?
raise Errors::InvalidRegions.new("A month must contain at least one region, received: #{months}") if month_def['regions'].nil? || month_def['regions'].empty?
month_def['regions'].each do |region|
raise Errors::InvalidRegions.new("A month must contain at least one region, received: #{months}") if region.nil? || region.empty?
end
if month_def.key?("year_ranges")
raise Errors::InvalidMonth.new("year_ranges only supports a single selector at this time, received: #{months}") unless month_def["year_ranges"].is_a?(Hash) && month_def["year_ranges"].size == 1
selector = month_def["year_ranges"].keys.first
value = month_def["year_ranges"][selector]
raise Errors::InvalidMonth.new("The :year_ranges value only accepts the following: :until, :from, :limited, :between, received: #{months}") unless [:until, :from, :limited, :between].include?(selector.to_sym)
case selector
when "until"
raise Errors::InvalidMonth.new("The year_ranges.until value must contain a single 'year' integer, ex. 2018, received: #{months}") unless value.is_a?(Integer)
when "from"
raise Errors::InvalidMonth.new("The year_ranges.from value must contain a single 'year' integer, ex. 2018, received: #{months}") unless value.is_a?(Integer)
when "limited"
raise Errors::InvalidMonth.new("The year_ranges.limited value must contain an array of 'year' integers, ex. [2018], received: #{months}") unless value.is_a?(Array)
value.each do |j|
raise Errors::InvalidMonth.new("The year_ranges.limited value must contain an array of 'year' integers, ex. [2018], received: #{months}") unless j.is_a?(Integer)
end
when "between"
raise Errors::InvalidMonth.new("year_ranges.between must contain both a 'start' and 'end' key, received: #{months}") unless value.is_a?(Hash) && value.key?("start") && value.key?("end")
raise Errors::InvalidMonth.new("The year_ranges.between.start value must contain a single 'year' integer, ex. 2018, received: #{months}") unless value["start"].is_a?(Integer)
raise Errors::InvalidMonth.new("The year_ranges.between.end value must contain a single 'year' integer, ex. 2018, received: #{months}") unless value["end"].is_a?(Integer)
raise Errors::InvalidMonth.new("The year_ranges.between.end value cannot be before the start value, received: #{months}") if value["end"] < value["start"]
raise Errors::InvalidMonth.new("The year_ranges.between start and end values cannot be the same, received: #{months}") if value["end"] == value["start"]
end
end
end
end
true
end
end
end
end

View File

@ -0,0 +1,66 @@
## encoding: utf-8
require 'yaml'
require_relative 'error'
require_relative 'definition_validator'
require_relative 'custom_method_validator'
require_relative 'month_validator'
require_relative 'test_validator'
definitions_path = '/../../'
module Definitions
class Validate
def initialize(path, definition_validator)
@path = path
@definition_validator = definition_validator
end
def call
path = File.expand_path(File.dirname(__FILE__)) + @path
definition_count = 0
Dir.foreach(path) do |item|
next if item == '.' or item == '..'
target = path+item
next if File.extname(target) != '.yaml'
next if item == 'index.yaml'
definition_count += 1
begin
definition_file = YAML.load(File.open(target))
validate!(definition_file)
rescue Psych::SyntaxError => e
puts "Failed on file '#{target}', YAML parse error: #{e}"
puts "This means your YAML is somehow invalid. Test your file on something like yamllint.com to find the issue."
exit
rescue => e
puts "Failed on file '#{target}', error: #{e}"
exit
end
end
puts "Success!"
puts "Definition count: #{definition_count}"
end
private
def validate!(definition)
raise StandardError unless @definition_validator.call(definition)
end
end
end
Definitions::Validate.new(
definitions_path,
Definitions::Validation::Definition.new(
Definitions::Validation::CustomMethod.new,
Definitions::Validation::Month.new,
Definitions::Validation::Test.new,
),
).call

View File

@ -0,0 +1,83 @@
require 'date'
require_relative 'error'
module Definitions
module Validation
class Test
def call(tests)
err!("Tests cannot be nil") if tests.nil?
err!("Tests cannot be empty. They are too important to leave out!") if tests.empty?
err!("Tests must be an array") unless tests.is_a?(Array)
tests.each do |t|
validate!(t)
end
true
end
private
def err!(msg)
raise Errors::InvalidTest.new(msg)
end
def validate!(t)
validate_given!(t["given"])
validate_expect!(t["expect"])
rescue Errors::InvalidTest => e
raise Errors::InvalidTest.new("#{e.message} - #{t.inspect}")
end
def validate_given!(g)
err!("Test must contain given key") if g.nil?
validate_regions!(g["regions"])
validate_options!(g["options"])
validate_date_values!(g)
end
def validate_regions!(regions)
err!("Test contains invalid regions (must be an array of strings)") unless regions.is_a?(Array)
err!("Test must contain at least one region") if regions.nil? || regions.empty?
regions.each do |r|
err!("Test cannot contain empty regions") if r.empty?
end
end
def validate_options!(opts)
if opts
opts = [ opts ] unless opts.is_a?(Array)
opts.each do |opt|
err!("Test contains invalid option(s)") unless opt == "informal" || opt == "observed"
end
end
end
def validate_date_values!(given)
err!("Test must contain some date") unless given.has_key?("date")
given["date"] = [ given["date"] ] unless given["date"].is_a?(Array)
given["date"].each do |d|
parse_date!(d)
end
end
def parse_date!(d)
DateTime.parse(d)
rescue TypeError, ArgumentError, NoMethodError
err!("Test must contain valid date, date value was: '#{d}")
end
def validate_expect!(e)
err!("Test must contain expect key") if e.nil?
if e.has_key?("holiday") && ![true, false].include?(e["holiday"])
err!("Test contains invalid holiday value (must be true/false)")
end
end
end
end
end

190
vendor/holidays/definitions/lt.yaml vendored Normal file
View File

@ -0,0 +1,190 @@
# Lithuanian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2014-10-02
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Lithuania
# - http://day.lt/sventes/nedarbo
---
months:
0:
- name: Šv. Velykos
regions: [lt]
function: easter(year)
- name: Antroji Velykų diena
regions: [lt]
function: easter(year)
function_modifier: 1
1:
- name: Naujieji metai
regions: [lt]
mday: 1
2:
- name: Valstybės atkūrimo diena
regions: [lt]
mday: 16
3:
- name: Nepriklausomybės atkūrimo diena
regions: [lt]
mday: 11
5:
- name: Darbininkų diena
regions: [lt]
mday: 1
6:
- name: Joninės
regions: [lt]
mday: 24
7:
- name: Valstybės diena
regions: [lt]
mday: 6
8:
- name: Žolinė
regions: [lt]
mday: 15
11:
- name: Visų šventųjų diena
regions: [lt]
mday: 1
12:
- name: Šv. Kūčios
regions: [lt]
mday: 24
- name: Šv. Kalėdos
regions: [lt]
mday: 25
- name: Antroji Kalėdų diena
regions: [lt]
mday: 26
tests:
- given:
date: '2008-01-01'
regions: ["lt"]
expect:
name: "Naujieji metai"
- given:
date: '2008-02-16'
regions: ["lt"]
expect:
name: "Valstybės atkūrimo diena"
- given:
date: '2008-03-11'
regions: ["lt"]
expect:
name: "Nepriklausomybės atkūrimo diena"
- given:
date: '2008-03-23'
regions: ["lt"]
expect:
name: "Šv. Velykos"
- given:
date: '2008-03-24'
regions: ["lt"]
expect:
name: "Antroji Velykų diena"
- given:
date: '2008-05-01'
regions: ["lt"]
expect:
name: "Darbininkų diena"
- given:
date: '2008-06-24'
regions: ["lt"]
expect:
name: "Joninės"
- given:
date: '2008-07-06'
regions: ["lt"]
expect:
name: "Valstybės diena"
- given:
date: '2008-08-15'
regions: ["lt"]
expect:
name: "Žolinė"
- given:
date: '2008-11-01'
regions: ["lt"]
expect:
name: "Visų šventųjų diena"
- given:
date: '2008-12-24'
regions: ["lt"]
expect:
name: "Šv. Kūčios"
- given:
date: '2008-12-25'
regions: ["lt"]
expect:
name: "Šv. Kalėdos"
- given:
date: '2008-12-26'
regions: ["lt"]
expect:
name: "Antroji Kalėdų diena"
- given:
date: '2012-01-01'
regions: ["lt"]
expect:
name: "Naujieji metai"
- given:
date: '2012-02-16'
regions: ["lt"]
expect:
name: "Valstybės atkūrimo diena"
- given:
date: '2012-03-11'
regions: ["lt"]
expect:
name: "Nepriklausomybės atkūrimo diena"
- given:
date: '2012-04-08'
regions: ["lt"]
expect:
name: "Šv. Velykos"
- given:
date: '2012-04-09'
regions: ["lt"]
expect:
name: "Antroji Velykų diena"
- given:
date: '2012-05-01'
regions: ["lt"]
expect:
name: "Darbininkų diena"
- given:
date: '2012-06-24'
regions: ["lt"]
expect:
name: "Joninės"
- given:
date: '2012-07-06'
regions: ["lt"]
expect:
name: "Valstybės diena"
- given:
date: '2012-08-15'
regions: ["lt"]
expect:
name: "Žolinė"
- given:
date: '2012-11-01'
regions: ["lt"]
expect:
name: "Visų šventųjų diena"
- given:
date: '2012-12-24'
regions: ["lt"]
expect:
name: "Šv. Kūčios"
- given:
date: '2012-12-25'
regions: ["lt"]
expect:
name: "Šv. Kalėdos"
- given:
date: '2012-12-26'
regions: ["lt"]
expect:
name: "Antroji Kalėdų diena"

123
vendor/holidays/definitions/lu.yaml vendored Normal file
View File

@ -0,0 +1,123 @@
# Luxembourg holiday definitions for the Ruby Holiday gem.
#
# Updated: 2020-01-21.
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Luxembourg
---
months:
0:
- name: Ouschterméindeg
regions: [lu]
function: easter(year)
function_modifier: 1
- name: Christi Himmelfaart
regions: [lu]
function: easter(year)
function_modifier: 39
- name: Péngschtméindeg
regions: [lu]
function: easter(year)
function_modifier: 49
1:
- name: Neijoerschdag
regions: [lu]
mday: 1
5:
- name: Dag vun der Aarbecht
regions: [lu]
mday: 1
- name: Europadag
regions: [lu]
mday: 9
year_ranges:
from: 2019
6:
- name: Nationalfeierdag
regions: [lu]
mday: 23
8:
- name: Léiffrawëschdag
regions: [lu]
mday: 15
11:
- name: Allerhellgen
regions: [lu]
mday: 1
12:
- name: Chrëschtdag
regions: [lu]
mday: 25
- name: Stiefesdag
regions: [lu]
mday: 26
tests:
- given:
date: '2008-01-01'
regions: ["lu"]
options: ["informal"]
expect:
name: "Neijoerschdag"
- given:
date: '2008-03-24'
regions: ["lu"]
options: ["informal"]
expect:
name: "Ouschterméindeg"
- given:
date: '2008-05-01'
regions: ["lu"]
options: ["informal"]
expect:
name: "Christi Himmelfaart"
- given:
date: '2008-06-23'
regions: ["lu"]
options: ["informal"]
expect:
name: "Nationalfeierdag"
- given:
date: '2008-08-15'
regions: ["lu"]
options: ["informal"]
expect:
name: "Léiffrawëschdag"
- given:
date: '2008-11-01'
regions: ["lu"]
options: ["informal"]
expect:
name: "Allerhellgen"
- given:
date: '2008-12-25'
regions: ["lu"]
options: ["informal"]
expect:
name: "Chrëschtdag"
- given:
date: '2008-12-26'
regions: ["lu"]
options: ["informal"]
expect:
name: "Stiefesdag"
- given:
date: '2008-05-11'
regions: ["lu"]
options: ["informal"]
expect:
name: "Péngschtméindeg"
- given:
date: '2019-05-01'
regions: ["lu"]
expect:
name: "Dag vun der Aarbecht"
- given:
date: '2019-05-09'
regions: ["lu"]
expect:
name: "Europadag"
- given:
date: '2018-05-09'
regions: ["lu"]
expect:
holiday: false

216
vendor/holidays/definitions/lv.yaml vendored Normal file
View File

@ -0,0 +1,216 @@
# Latvian holiday definitions for the Ruby Holiday gem.
#
# Updated: 2019-05-01
# Sources:
# - https://likumi.lv/ta/id/72608 (Likums "Par svētku, atceres un atzīmējamām dienām")
---
months:
0:
- name: Lielā Piektdiena # Good Friday
regions: [lv]
function: easter(year)
function_modifier: -2
- name: Pirmās Lieldienas # Easter Sunday
regions: [lv]
function: easter(year)
- name: Otrās Lieldienas # Easter Monday
regions: [lv]
function: easter(year)
function_modifier: 1
- name: Vasarsvētki # Summer's Day / Pentecost
regions: [lv]
function: easter(year)
function_modifier: 49
- name: Vispārējo latviešu Dziesmu un deju svētku noslēguma diena
regions: [lv]
function: lv_song_and_dance_festival_end_date(year)
observed: to_monday_if_weekend(date)
year_ranges:
from: 2018
1:
- name: Jaungada diena # New Year's Day
regions: [lv]
mday: 1
5:
- name: Darba svētki, Latvijas Republikas Satversmes sapulces sasaukšanas diena # Labor day, Anniversary of the Convocation of the Constitutional Assembly of the Republic of Latvia
regions: [lv]
mday: 1
- name: Latvijas Republikas Neatkarības atjaunošanas diena # Day of the Restoration of Independence of the Republic of Latvia
regions: [lv]
mday: 4
observed: to_monday_if_weekend(date)
- name: Mātes diena # Mother's Day
regions: [lv]
week: 2
wday: 0
6:
- name: Līgo diena # Midsummer
regions: [lv]
mday: 23
- name: Jāņu diena # Midsummer
regions: [lv]
mday: 24
9:
- name: Viņa Svētības pāvesta Franciska pastorālās vizītes Latvijā diena # Visit of Pope Francis
regions: [lv]
mday: 24
year_ranges:
limited: [2018]
11:
- name: Latvijas Republikas Proklamēšanas diena # Proclamation Day of the Republic of Latvia
regions: [lv]
mday: 18
observed: to_monday_if_weekend(date)
12:
- name: Ziemassvētku vakars # Christmas Eve
regions: [lv]
mday: 24
- name: Pirmie Ziemassvētki # Christmas Day
regions: [lv]
mday: 25
- name: Otrie Ziemassvētki # Boxing Day
regions: [lv]
mday: 26
- name: Vecgada diena # New Year's Eve
regions: [lv]
mday: 31
methods:
lv_song_and_dance_festival_end_date:
arguments: year
ruby: |
case year
when 2018
# https://likumi.lv/ta/id/281541 (Ministru kabineta rīkojums Nr. 252 "Par XXVI Vispārējo latviešu dziesmu un XVI Deju svētku norises laiku")
Date.new(2018, 7, 8)
when 2023
# Event's period/next year is known, but precise dates aren't.
# Previously, dates were announced 2 years ahead, so at ~2021-05 this method would need to be revisited.
end
tests:
- given:
date: ['2018-01-01', '2019-01-01', '2029-01-01']
regions: ["lv"]
expect:
name: "Jaungada diena"
- given:
date: ['2018-03-30', '2019-04-19', '2039-04-08']
regions: ["lv"]
expect:
name: "Lielā Piektdiena"
- given:
date: ['2018-04-01', '2019-04-21', '2039-04-10']
regions: ["lv"]
expect:
name: "Pirmās Lieldienas"
- given:
date: ['2018-04-02', '2019-04-22', '2039-04-11']
regions: ["lv"]
expect:
name: "Otrās Lieldienas"
- given:
date: ['2018-05-01', '2019-05-01', '2029-05-01']
regions: ["lv"]
expect:
name: "Darba svētki, Latvijas Republikas Satversmes sapulces sasaukšanas diena"
- given:
date: ['2018-05-04', '2019-05-04', '2020-05-04']
regions: ["lv"]
expect:
name: "Latvijas Republikas Neatkarības atjaunošanas diena"
- given:
date: '2019-05-06'
regions: ["lv"]
options: ["observed"]
expect:
name: "Latvijas Republikas Neatkarības atjaunošanas diena"
- given:
date: '2020-05-04'
regions: ["lv"]
options: ["observed"]
expect:
name: "Latvijas Republikas Neatkarības atjaunošanas diena"
- given:
date: ['2019-05-12', '2020-05-10', '2029-05-13']
regions: ["lv"]
expect:
name: "Mātes diena"
- given:
date: ['2019-06-09', '2020-05-31', '2029-05-20']
regions: ["lv"]
expect:
name: "Vasarsvētki"
- given:
date: ['2019-06-23', '2020-06-23', '2029-06-23']
regions: ["lv"]
expect:
name: "Līgo diena"
- given:
date: ['2019-06-24', '2020-06-24', '2029-06-24']
regions: ["lv"]
expect:
name: "Jāņu diena"
- given:
date: '2018-07-08'
regions: ["lv"]
expect:
name: "Vispārējo latviešu Dziesmu un deju svētku noslēguma diena"
- given:
date: '2018-07-09'
regions: ["lv"]
options: ["observed"]
expect:
name: "Vispārējo latviešu Dziesmu un deju svētku noslēguma diena"
- given:
date: ['2019-07-08', '2019-07-09']
regions: ["lv"]
expect:
holiday: false
- given:
date: '2018-09-24'
regions: ["lv"]
expect:
name: "Viņa Svētības pāvesta Franciska pastorālās vizītes Latvijā diena"
- given:
date: '2019-09-24'
regions: ["lv"]
expect:
holiday: false
- given:
date: ['2019-11-18', '2020-11-18', '2029-11-18']
regions: ["lv"]
expect:
name: "Latvijas Republikas Proklamēšanas diena"
- given:
date: '2020-11-18'
regions: ["lv"]
options: ["observed"]
expect:
name: "Latvijas Republikas Proklamēšanas diena"
- given:
date: '2029-11-19'
regions: ["lv"]
options: ["observed"]
expect:
name: "Latvijas Republikas Proklamēšanas diena"
- given:
date: ['2019-12-24', '2020-12-24', '2029-12-24']
regions: ["lv"]
expect:
name: "Ziemassvētku vakars"
- given:
date: ['2019-12-25', '2020-12-25', '2029-12-25']
regions: ["lv"]
expect:
name: "Pirmie Ziemassvētki"
- given:
date: ['2019-12-26', '2020-12-26', '2029-12-26']
regions: ["lv"]
expect:
name: "Otrie Ziemassvētki"
- given:
date: ['2019-12-31', '2020-12-31', '2029-12-31']
regions: ["lv"]
expect:
name: "Vecgada diena"

96
vendor/holidays/definitions/ma.yaml vendored Normal file
View File

@ -0,0 +1,96 @@
# Morocco holiday (incomplete)definitions for the Ruby Holiday gem.
#
# Updated: 2013-07-01.
# Some dates in Islamic Calendar are missing.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Morocco
---
months:
1:
- name: Ras l' âm
regions: [ma]
mday: 1
- name: Takdim watikat al-istiqlal
regions: [ma]
mday: 11
5:
- name: Eid Ash-Shughl
regions: [ma]
mday: 1
7:
- name: Eid Al-Ârch
regions: [ma]
mday: 30
8:
- name: Zikra Oued Ed-Dahab
regions: [ma]
mday: 14
- name: Thawrat al malik wa shâab
regions: [ma]
mday: 20
- name: Eid Al Milad
regions: [ma]
mday: 21
11:
- name: Eid Al Massira Al Khadra
regions: [ma]
mday: 6
- name: Eid Al Istiqulal
regions: [ma]
mday: 18
tests:
- given:
date: '2007-01-01'
regions: ["ma"]
options: ["informal"]
expect:
name: "Ras l' âm"
- given:
date: '2007-01-11'
regions: ["ma"]
options: ["informal"]
expect:
name: "Takdim watikat al-istiqlal"
- given:
date: '2007-05-01'
regions: ["ma"]
options: ["informal"]
expect:
name: "Eid Ash-Shughl"
- given:
date: '2007-07-30'
regions: ["ma"]
options: ["informal"]
expect:
name: "Eid Al-Ârch"
- given:
date: '2007-08-14'
regions: ["ma"]
options: ["informal"]
expect:
name: "Zikra Oued Ed-Dahab"
- given:
date: '2007-08-20'
regions: ["ma"]
options: ["informal"]
expect:
name: "Thawrat al malik wa shâab"
- given:
date: '2007-08-21'
regions: ["ma"]
options: ["informal"]
expect:
name: "Eid Al Milad"
- given:
date: '2007-11-06'
regions: ["ma"]
options: ["informal"]
expect:
name: "Eid Al Massira Al Khadra"
- given:
date: '2007-11-18'
regions: ["ma"]
options: ["informal"]
expect:
name: "Eid Al Istiqulal"

131
vendor/holidays/definitions/mt_en.yaml vendored Normal file
View File

@ -0,0 +1,131 @@
# Maltese holiday definitions for the Ruby Holiday gem. In English.
#
# Updated: 2017-06-08
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Malta
---
months:
0:
- name: Good Friday # Il-Ġimgħa l-Kbira
regions: [mt_en]
function: easter(year)
function_modifier: -2
1:
- name: New Year's Day # L-Ewwel tas-Sena
regions: [mt_en]
mday: 1
2:
- name: Feast of Saint Paul's Shipwreck in Malta # Nawfraġju ta' San Pawl
regions: [mt_en]
mday: 10
3:
- name: Feast of Saint Joseph # San Ġużepp
regions: [mt_en]
mday: 19
- name: Freedom Day # Jum il-Ħelsien
regions: [mt_en]
mday: 31
5:
- name: Worker's Day # Jum il-Ħaddiem
regions: [mt_en]
mday: 1
6:
- name: Sette Giugno
regions: [mt_en]
mday: 7
- name: Feast of Saint Peter & Saint Paul # L-Imnarja
regions: [mt_en]
mday: 29
8:
- name: Feast of the Assumption of Our Lady # Santa Marija
regions: [mt_en]
mday: 15
9:
- name: Victory Day # Jum il-Vitorja
regions: [mt_en]
mday: 8
- name: Independence Day # Jum l-Indipendenza
regions: [mt_en]
mday: 21
12:
- name: Feast of the Immaculate Conception # Il-Kunċizzjoni
regions: [mt_en]
mday: 8
- name: Republic Day # Jum ir-Repubblika
regions: [mt_en]
mday: 13
- name: Christmas Day # Il-Milied
regions: [mt_en]
mday: 25
tests:
- given:
date: '2017-1-1'
regions: ["mt_en"]
expect:
name: "New Year's Day"
- given:
date: '2017-2-10'
regions: ["mt_en"]
expect:
name: "Feast of Saint Paul's Shipwreck in Malta"
- given:
date: '2017-3-19'
regions: ["mt_en"]
expect:
name: "Feast of Saint Joseph"
- given:
date: '2017-3-31'
regions: ["mt_en"]
expect:
name: "Freedom Day"
- given:
date: '2017-5-1'
regions: ["mt_en"]
expect:
name: "Worker's Day"
- given:
date: '2017-6-7'
regions: ["mt_en"]
expect:
name: "Sette Giugno"
- given:
date: '2017-6-29'
regions: ["mt_en"]
expect:
name: "Feast of Saint Peter & Saint Paul"
- given:
date: '2017-8-15'
regions: ["mt_en"]
expect:
name: "Feast of the Assumption of Our Lady"
- given:
date: '2017-9-8'
regions: ["mt_en"]
expect:
name: "Victory Day"
- given:
date: '2017-9-21'
regions: ["mt_en"]
expect:
name: "Independence Day"
- given:
date: '2017-12-8'
regions: ["mt_en"]
expect:
name: "Feast of the Immaculate Conception"
- given:
date: '2017-12-13'
regions: ["mt_en"]
expect:
name: "Republic Day"
- given:
date: '2017-12-25'
regions: ["mt_en"]
expect:
name: "Christmas Day"
- given:
date: ['2017-4-14', '2018-3-30', '2019-4-19']
regions: ["mt_en"]
expect:
name: "Good Friday"

131
vendor/holidays/definitions/mt_mt.yaml vendored Normal file
View File

@ -0,0 +1,131 @@
# Maltese holiday definitions for the Ruby Holiday gem. In Maltese.
#
# Updated: 2017-06-08
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Malta
---
months:
0:
- name: Il-Ġimgħa l-Kbira # Good Friday
regions: [mt_mt]
function: easter(year)
function_modifier: -2
1:
- name: L-Ewwel tas-Sena # New Year's Day
regions: [mt_mt]
mday: 1
2:
- name: Nawfraġju ta' San Pawl # Feast of Saint Paul's Shipwreck in Malta
regions: [mt_mt]
mday: 10
3:
- name: San Ġużepp # Feast of Saint Joseph
regions: [mt_mt]
mday: 19
- name: Jum il-Ħelsien # Freedom Day
regions: [mt_mt]
mday: 31
5:
- name: Jum il-Ħaddiem # Worker's Day
regions: [mt_mt]
mday: 1
6:
- name: Sette Giugno
regions: [mt_mt]
mday: 7
- name: L-Imnarja # Feast of Saint Peter & Saint Paul
regions: [mt_mt]
mday: 29
8:
- name: Santa Marija # Feast of the Assumption of Our Lady
regions: [mt_mt]
mday: 15
9:
- name: Jum il-Vitorja # Victory Day
regions: [mt_mt]
mday: 8
- name: Jum l-Indipendenza # Independence Day
regions: [mt_mt]
mday: 21
12:
- name: Il-Kunċizzjoni # Feast of the Immaculate Conception
regions: [mt_mt]
mday: 8
- name: Jum ir-Repubblika # Republic Day
regions: [mt_mt]
mday: 13
- name: Il-Milied # Christmas Day
regions: [mt_mt]
mday: 25
tests:
- given:
date: '2017-1-1'
regions: ["mt_mt"]
expect:
name: "L-Ewwel tas-Sena"
- given:
date: '2017-2-10'
regions: ["mt_mt"]
expect:
name: "Nawfraġju ta' San Pawl"
- given:
date: '2017-3-19'
regions: ["mt_mt"]
expect:
name: "San Ġużepp"
- given:
date: '2017-3-31'
regions: ["mt_mt"]
expect:
name: "Jum il-Ħelsien"
- given:
date: '2017-5-1'
regions: ["mt_mt"]
expect:
name: "Jum il-Ħaddiem"
- given:
date: '2017-6-7'
regions: ["mt_mt"]
expect:
name: "Sette Giugno"
- given:
date: '2017-6-29'
regions: ["mt_mt"]
expect:
name: "L-Imnarja"
- given:
date: '2017-8-15'
regions: ["mt_mt"]
expect:
name: "Santa Marija"
- given:
date: '2017-9-8'
regions: ["mt_mt"]
expect:
name: "Jum il-Vitorja"
- given:
date: '2017-9-21'
regions: ["mt_mt"]
expect:
name: "Jum l-Indipendenza"
- given:
date: '2017-12-8'
regions: ["mt_mt"]
expect:
name: "Il-Kunċizzjoni"
- given:
date: '2017-12-13'
regions: ["mt_mt"]
expect:
name: "Jum ir-Repubblika"
- given:
date: '2017-12-25'
regions: ["mt_mt"]
expect:
name: "Il-Milied"
- given:
date: ['2017-4-14', '2018-3-30', '2019-4-19']
regions: ["mt_mt"]
expect:
name: "Il-Ġimgħa l-Kbira"

153
vendor/holidays/definitions/mx.yaml vendored Normal file
View File

@ -0,0 +1,153 @@
# Mexican holiday definitions for the Ruby Holiday gem.
# Updated 2008-12-05.
# Sources:
# - http://www.britishembassy.gov.uk/servlet/Front?pagename=OpenMarket/Xcelerate/ShowPage&c=Page&cid=1125561634963
# - http://www.usembassy-mexico.gov/eng/holidays.html
---
months:
1:
- name: Año nuevo
regions: [mx]
mday: 1
- name: Dia de los Santos Reyes
regions: [mx]
mday: 6
type: informal
2:
- name: Día de la Constitución
week: 1
regions: [mx]
wday: 1
3:
- name: Natalicio de Benito Juárez
week: 3
regions: [mx]
wday: 1
4:
- name: Día del Niño
regions: [mx]
mday: 30
type: informal
5:
- name: Día del Trabajo
regions: [mx]
mday: 1
- name: Cinco de Mayo
regions: [mx]
mday: 5
type: informal
- name: La Batalla de Puebla
regions: [mx_pue]
mday: 5
type: informal
- name: Día de la Madre
regions: [mx]
mday: 10
type: informal
- name: Día del Maestro
regions: [mx]
mday: 15
type: informal
6:
- name: Día del Padre
regions: [mx]
wday: 0
week: 3
type: informal
9:
- name: Grito de Dolores
regions: [mx]
mday: 15
- name: Día de la Independencia
regions: [mx]
mday: 16
10:
- name: Día de la Raza
regions: [mx]
mday: 12
type: informal
11:
- name: Todos los Santos
regions: [mx]
mday: 1
type: informal
- name: Los Fieles Difuntos
regions: [mx]
mday: 2
type: informal
- name: Día de la Revolución
week: 3
regions: [mx]
wday: 1
12:
- name: Día de la Virgen de Guadalupe
regions: [mx]
mday: 12
type: informal
- name: Nochebuena
regions: [mx]
mday: 24
type: informal
- name: Navidad
regions: [mx]
mday: 25
- name: Los Santos Inocentes
regions: [mx]
mday: 28
type: informal
tests:
- given:
date: '2007-01-01'
regions: ["mx"]
options: ["informal"]
expect:
name: "Año nuevo"
- given:
date: '2007-02-05'
regions: ["mx"]
options: ["informal"]
expect:
name: "Día de la Constitución"
- given:
date: '2007-05-01'
regions: ["mx"]
options: ["informal"]
expect:
name: "Día del Trabajo"
- given:
date: '2007-05-05'
regions: ["mx"]
options: ["informal"]
expect:
name: "Cinco de Mayo"
- given:
date: '2007-09-16'
regions: ["mx"]
options: ["informal"]
expect:
name: "Día de la Independencia"
- given:
date: '2007-11-01'
regions: ["mx"]
options: ["informal"]
expect:
name: "Todos los Santos"
- given:
date: '2007-11-02'
regions: ["mx"]
options: ["informal"]
expect:
name: "Los Fieles Difuntos"
- given:
date: '2007-11-19'
regions: ["mx"]
options: ["informal"]
expect:
name: "Día de la Revolución"
- given:
date: '2007-12-25'
regions: ["mx"]
options: ["informal"]
expect:
name: "Navidad"

79
vendor/holidays/definitions/my.yaml vendored Normal file
View File

@ -0,0 +1,79 @@
# Malaysia holiday definitions for the Holidays gem!
# Days not included in the definitions (yet):
# Vesak Day (falls on the first full moon in May)
# Lunar New Year (falls on the first day of the Lunar Calendar)
# Hari Raya Puasa and Hari Raya Haji (based on moon sightings, Islamic Calendar)
# Deepavali (15th Day of September or October, based on the Hindu Calendar)
# Source:
# http://publicholidays.com.my/
months:
1:
- name: New Year's Day
regions: [my]
mday: 1
observed: to_weekday_if_weekend(date)
5:
- name: Labour Day
regions: [my]
mday: 1
6:
- name: Agong's Birthday
regions: [my]
mday: 4
observed: to_weekday_if_weekend(date)
8:
- name: Independence Day
regions: [my]
mday: 31
observed: to_weekday_if_weekend(date)
9:
- name: Malaysia Day
regions: [my]
mday: 16
observed: to_weekday_if_weekend(date)
12:
- name: Christmas Day
regions: [my]
mday: 25
observed: to_weekday_if_weekend(date)
tests:
- given:
date: '2016-01-01'
regions: ["my"]
options: ["informal"]
expect:
name: "New Year's Day"
- given:
date: '2016-05-01'
regions: ["my"]
options: ["informal"]
expect:
name: "Labour Day"
- given:
date: '2016-06-04'
regions: ["my"]
options: ["informal"]
expect:
name: "Agong's Birthday"
- given:
date: '2016-08-31'
regions: ["my"]
options: ["informal"]
expect:
name: "Independence Day"
- given:
date: '2016-09-16'
regions: ["my"]
options: ["informal"]
expect:
name: "Malaysia Day"
- given:
date: '2016-12-25'
regions: ["my"]
options: ["informal"]
expect:
name: "Christmas Day"

94
vendor/holidays/definitions/nerc.yaml vendored Normal file
View File

@ -0,0 +1,94 @@
# NERC holiday definitions for the Ruby Holiday gem.
#
# By Adam Strickland
# Source: www.nerc.com/docs/oc/rs/Additional_Off-peak_Days.doc
#
# Updated 2013-01-03.
---
months:
1:
- name: New Year's Day
regions: [nerc]
mday: 1
observed: to_monday_if_sunday(date)
5:
- name: Memorial Day
week: -1
regions: [nerc]
wday: 1
7:
- name: Independence Day
regions: [nerc]
mday: 4
observed: to_monday_if_sunday(date)
9:
- name: Labor Day
week: 1
regions: [nerc]
wday: 1
11:
- name: Thanksgiving
week: 4
regions: [nerc]
wday: 4
12:
- name: Christmas Day
regions: [nerc]
mday: 25
observed: to_monday_if_sunday(date)
tests:
- given:
date: '2013-01-01'
regions: ["nerc"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2017-01-02'
regions: ["nerc"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2013-05-27'
regions: ["nerc"]
options: ["observed"]
expect:
name: "Memorial Day"
- given:
date: '2013-07-04'
regions: ["nerc"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2010-07-05'
regions: ["nerc"]
options: ["observed"]
expect:
name: "Independence Day"
- given:
date: '2013-09-02'
regions: ["nerc"]
options: ["observed"]
expect:
name: "Labor Day"
- given:
date: '2013-11-28'
regions: ["nerc"]
options: ["observed"]
expect:
name: "Thanksgiving"
- given:
date: '2013-12-25'
regions: ["nerc"]
options: ["observed"]
expect:
name: "Christmas Day"
- given:
date: '2011-12-26'
regions: ["nerc"]
options: ["observed"]
expect:
name: "Christmas Day"

97
vendor/holidays/definitions/ng.yaml vendored Normal file
View File

@ -0,0 +1,97 @@
# Nigeria holiday definitions for the Ruby Holiday gem.
# Updated: 2020-04-28
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Nigeria
---
months:
0:
- name: Good Friday
regions: [ng]
function: easter(year)
function_modifier: -2
- name: Easter Monday
regions: [ng]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [ng]
mday: 1
observed: to_monday_if_weekend(date)
5:
- name: Workers' Day
regions: [ng]
mday: 1
observed: to_monday_if_weekend(date)
- name: Children's Day
regions: [ng]
mday: 27
type: informal
6:
- name: Democracy Day
regions: [ng]
mday: 12
year_ranges:
from: 2018
10:
- name: Independence Day
regions: [ng]
mday: 1
observed: to_monday_if_weekend(date)
12:
- name: Christmas Day
regions: [ng]
mday: 25
observed: to_monday_if_weekend(date)
- name: Boxing Day
regions: [ng]
mday: 26
observed: to_weekday_if_boxing_weekend(date)
tests:
- given:
date: '2008-03-21'
regions: ["ng"]
expect:
name: "Good Friday"
- given:
date: '2008-03-24'
regions: ["ng"]
expect:
name: "Easter Monday"
- given:
date: '2008-01-01'
regions: ["ng"]
expect:
name: "New Year's Day"
- given:
date: '2008-05-01'
regions: ["ng"]
expect:
name: "Workers' Day"
- given:
date: '2008-05-27'
regions: ["ng"]
options: ["informal"]
expect:
name: "Children's Day"
- given:
date: '2019-06-12'
regions: ["ng"]
expect:
name: "Democracy Day"
- given:
date: '2008-10-01'
regions: ["ng"]
expect:
name: "Independence Day"
- given:
date: '2008-12-25'
regions: ["ng"]
expect:
name: "Christmas Day"
- given:
date: '2008-12-26'
regions: ["ng"]
expect:
name: "Boxing Day"

127
vendor/holidays/definitions/nl.yaml vendored Normal file
View File

@ -0,0 +1,127 @@
# Dutch holiday definitions for the Ruby Holiday gem.
#
# Updated: 2014-04-17.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_the_Netherlands
---
months:
0:
- name: Goede Vrijdag
regions: [nl]
function: easter(year)
function_modifier: -2
type: informal
- name: Eerste Paasdag
regions: [nl]
function: easter(year)
- name: Tweede Paasdag
regions: [nl]
function: easter(year)
function_modifier: 1
- name: Hemelvaartsdag
regions: [nl]
function: easter(year)
function_modifier: 39
- name: Eerste Pinksterdag
regions: [nl]
function: easter(year)
function_modifier: 49
- name: Tweede Pinksterdag
regions: [nl]
function: easter(year)
function_modifier: 50
1:
- name: Nieuwjaarsdag
regions: [nl]
mday: 1
4:
- name: Koningsdag
regions: [nl]
mday: 27
5:
- name: Dodenherdenking
regions: [nl]
mday: 4
type: informal
- name: Bevrijdingsdag
regions: [nl]
mday: 5
12:
- name: Sinterklaas
regions: [nl]
mday: 5
type: informal
- name: Eerste Kerstdag
regions: [nl]
mday: 25
- name: Tweede Kerstdag
regions: [nl]
mday: 26
tests:
- given:
date: '2008-01-01'
regions: ["nl"]
options: ["informal"]
expect:
name: "Nieuwjaarsdag"
- given:
date: '2008-03-21'
regions: ["nl"]
options: ["informal"]
expect:
name: "Goede Vrijdag"
- given:
date: '2008-03-23'
regions: ["nl"]
options: ["informal"]
expect:
name: "Eerste Paasdag"
- given:
date: '2008-03-24'
regions: ["nl"]
options: ["informal"]
expect:
name: "Tweede Paasdag"
- given:
date: '2008-04-27'
regions: ["nl"]
options: ["informal"]
expect:
name: "Koningsdag"
- given:
date: '2008-05-01'
regions: ["nl"]
options: ["informal"]
expect:
name: "Hemelvaartsdag"
- given:
date: '2008-05-05'
regions: ["nl"]
options: ["informal"]
expect:
name: "Bevrijdingsdag"
- given:
date: '2008-05-11'
regions: ["nl"]
options: ["informal"]
expect:
name: "Eerste Pinksterdag"
- given:
date: '2008-05-12'
regions: ["nl"]
options: ["informal"]
expect:
name: "Tweede Pinksterdag"
- given:
date: '2008-12-25'
regions: ["nl"]
options: ["informal"]
expect:
name: "Eerste Kerstdag"
- given:
date: '2008-12-26'
regions: ["nl"]
options: ["informal"]
expect:
name: "Tweede Kerstdag"

169
vendor/holidays/definitions/no.yaml vendored Normal file
View File

@ -0,0 +1,169 @@
# Norwegian holiday definitions for the Ruby Holiday gem.
#
# Added: 20010-02-22.
# Sources:
# - http://no.wikipedia.org/wiki/Offentlig_fridag
# - http://www.timeanddate.com/norsk/kalender.html
---
months:
0:
- name: Fastelavn
regions: ["no"]
function: easter(year)
function_modifier: -49
type: informal
- name: Palmesøndag
regions: ["no"]
function: easter(year)
function_modifier: -7
- name: Skjærtorsdag
regions: ["no"]
function: easter(year)
function_modifier: -3
- name: Langfredag
regions: ["no"]
function: easter(year)
function_modifier: -2
- name: 1. påskedag
regions: ["no"]
function: easter(year)
- name: 2. påskedag
regions: ["no"]
function: easter(year)
function_modifier: 1
- name: Kristi Himmelfartsdag
regions: ["no"]
function: easter(year)
function_modifier: 39
- name: 1. pinsedag
regions: ["no"]
function: easter(year)
function_modifier: 49
- name: 2. pinsedag
regions: ["no"]
function: easter(year)
function_modifier: 50
1:
- name: Nyttårsdag
regions: ["no"]
mday: 1
5:
- name: 1. mai
regions: ["no"]
mday: 1
- name: 17. mai
regions: ["no"]
mday: 17
12:
- name: Julaften
regions: ["no"]
mday: 24
type: informal
- name: 1. juledag
regions: ["no"]
mday: 25
- name: 2. juledag
regions: ["no"]
mday: 26
- name: Nyttårsaften
regions: ["no"]
mday: 31
type: informal
tests:
- given:
date: '2010-01-01'
regions: ["no"]
options: ["informal"]
expect:
name: "Nyttårsdag"
- given:
date: '2010-05-01'
regions: ["no"]
options: ["informal"]
expect:
name: "1. mai"
- given:
date: '2010-05-17'
regions: ["no"]
options: ["informal"]
expect:
name: "17. mai"
- given:
date: '2010-12-24'
regions: ["no"]
options: ["informal"]
expect:
name: "Julaften"
- given:
date: '2010-12-25'
regions: ["no"]
options: ["informal"]
expect:
name: "1. juledag"
- given:
date: '2010-12-26'
regions: ["no"]
options: ["informal"]
expect:
name: "2. juledag"
- given:
date: '2010-12-31'
regions: ["no"]
options: ["informal"]
expect:
name: "Nyttårsaften"
- given:
date: '2010-02-14'
regions: ["no"]
options: ["informal"]
expect:
name: "Fastelavn"
- given:
date: '2010-03-28'
regions: ["no"]
options: ["informal"]
expect:
name: "Palmesøndag"
- given:
date: '2010-04-01'
regions: ["no"]
options: ["informal"]
expect:
name: "Skjærtorsdag"
- given:
date: '2010-04-02'
regions: ["no"]
options: ["informal"]
expect:
name: "Langfredag"
- given:
date: '2010-04-04'
regions: ["no"]
options: ["informal"]
expect:
name: "1. påskedag"
- given:
date: '2010-04-05'
regions: ["no"]
options: ["informal"]
expect:
name: "2. påskedag"
- given:
date: '2010-05-13'
regions: ["no"]
options: ["informal"]
expect:
name: "Kristi Himmelfartsdag"
- given:
date: '2010-05-23'
regions: ["no"]
options: ["informal"]
expect:
name: "1. pinsedag"
- given:
date: '2010-05-24'
regions: ["no"]
options: ["informal"]
expect:
name: "2. pinsedag"

View File

@ -0,0 +1,105 @@
# Informal North American holiday definitions for the Ruby Holiday gem.
# Updated 2008-11-22.
---
months:
2:
- name: Groundhog Day
regions: [us, ca]
mday: 2
type: informal
- name: Valentine's Day
regions: [us, ca]
mday: 14
type: informal
3:
- name: St. Patrick's Day
regions: [us, ca]
mday: 17
type: informal
4:
- name: April Fool's Day
regions: [us, ca]
mday: 1
type: informal
- name: Earth Day
regions: [us, ca]
mday: 22
type: informal
5:
- name: Mother's Day
week: 2
regions: [us, ca]
wday: 0
type: informal
- name: Armed Forces Day
week: 3
regions: [us]
wday: 6
type: informal
6:
- name: Father's Day
week: 3
regions: [us, ca]
wday: 0
type: informal
10:
- name: Halloween
regions: [us, ca]
mday: 31
type: informal
tests:
- given:
date: '2013-02-02'
regions: ["us"]
options: ["informal"]
expect:
name: "Groundhog Day"
- given:
date: '2013-02-14'
regions: ["us"]
options: ["informal"]
expect:
name: "Valentine's Day"
- given:
date: '2013-03-17'
regions: ["us"]
options: ["informal"]
expect:
name: "St. Patrick's Day"
- given:
date: '2013-04-01'
regions: ["us"]
options: ["informal"]
expect:
name: "April Fool's Day"
- given:
date: '2013-04-22'
regions: ["us"]
options: ["informal"]
expect:
name: "Earth Day"
- given:
date: '2013-05-12'
regions: ["us"]
options: ["informal"]
expect:
name: "Mother's Day"
- given:
date: '2013-05-18'
regions: ["us"]
options: ["informal"]
expect:
name: "Armed Forces Day"
- given:
date: '2013-06-16'
regions: ["us"]
options: ["informal"]
expect:
name: "Father's Day"
- given:
date: '2013-10-31'
regions: ["us"]
options: ["informal"]
expect:
name: "Halloween"

116
vendor/holidays/definitions/nyse.yaml vendored Normal file
View File

@ -0,0 +1,116 @@
# NYSE holiday definitions for the Ruby Holiday gem.
#
# By Alan Larkin
# Source: http://www.nyse.com/about/newsevents/1176373643795.html#earlyclose2008
#
# Updated 2008-11-19.
#
# Source: https://www.nyse.com/markets/hours-calendars
# Updated 2017-03-14 By Vassilios Liatsos
---
months:
0:
- name: Good Friday
regions: [nyse]
function: easter(year)
function_modifier: -2
1:
- name: New Year's Day
regions: [nyse]
mday: 1
observed: to_monday_if_sunday(date)
- name: Martin Luther King, Jr. Day
week: 3
regions: [nyse]
wday: 1
2:
- name: Presidents' Day
week: 3
regions: [nyse]
wday: 1
5:
- name: Memorial Day
week: -1
regions: [nyse]
wday: 1
7:
- name: Independence Day
regions: [nyse]
mday: 4
observed: to_weekday_if_weekend(date)
9:
- name: Labor Day
week: 1
regions: [nyse]
wday: 1
11:
- name: Thanksgiving
week: 4
regions: [nyse]
wday: 4
12:
- name: Christmas Day
regions: [nyse]
mday: 25
observed: to_weekday_if_weekend(date)
tests:
- given:
date: '2008-01-01'
regions: ["nyse"]
expect:
name: "New Year's Day"
- given:
date: ['2017-01-02', '2012-01-02', '2011-01-01', '2006-01-02']
regions: ["nyse"]
options: ["observed"]
expect:
name: "New Year's Day"
- given:
date: '2008-01-21'
regions: ["nyse"]
expect:
name: "Martin Luther King, Jr. Day"
- given:
date: '2008-02-18'
regions: ["nyse"]
expect:
name: "Presidents' Day"
- given:
date: '2008-03-21'
regions: ["nyse"]
expect:
name: "Good Friday"
- given:
date: '2008-05-26'
regions: ["nyse"]
expect:
name: "Memorial Day"
- given:
date: '2008-07-04'
regions: ["nyse"]
expect:
name: "Independence Day"
- given:
date: '2008-09-01'
regions: ["nyse"]
expect:
name: "Labor Day"
- given:
date: '2008-11-27'
regions: ["nyse"]
expect:
name: "Thanksgiving"
- given:
date: '2008-12-25'
regions: ["nyse"]
expect:
name: "Christmas Day"
# Test observed New Year
- given:
date: ['2017-01-02', '2012-01-02', '2011-01-01', '2006-01-02']
regions: ["nyse"]
options: ["observed"]
expect:
name: "New Year's Day"

273
vendor/holidays/definitions/nz.yaml vendored Normal file
View File

@ -0,0 +1,273 @@
# New Zealand holiday definitions for the Ruby Holiday gem.
# Updated: 2010-03-28.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand
---
months:
0:
- name: Good Friday
regions: [nz]
function: easter(year)
function_modifier: -2
- name: Easter Monday
regions: [nz]
function: easter(year)
function_modifier: 1
1:
- name: New Year's Day
regions: [nz]
mday: 1
observed: to_monday_if_weekend(date)
- name: Day after New Year's Day
regions: [nz]
mday: 2
observed: to_weekday_if_boxing_weekend(date)
- name: Southland Anniversary Day
regions: [nz_sl]
mday: 17
- name: Wellington Anniversary Day
regions: [nz_we]
mday: 22
observed: closest_monday(date)
- name: Auckland Anniversary Day
regions: [nz_ak]
mday: 29
observed: closest_monday(date)
- name: Northland Anniversary Day
regions: [nz_nl]
mday: 29
observed: closest_monday(date)
2:
- name: Nelson Anniversary Day
regions: [nz_ne]
mday: 1
observed: closest_monday(date)
- name: Waitangi Day
regions: [nz]
mday: 6
observed: to_monday_if_weekend(date)
3:
- name: Otago Anniversary Day
regions: [nz_ot]
mday: 23
observed: closest_monday(date)
- name: Taranaki Anniversary Day
regions: [nz_ta]
week: 2
wday: 1
observed: closest_monday(date)
4:
- name: ANZAC Day
regions: [nz]
mday: 25
observed: to_monday_if_weekend(date)
6:
- name: Queen's Birthday
regions: [nz]
week: 1
wday: 1
9:
- name: Dominion Day
regions: [nz_sc]
week: 4
wday: 1
10:
- name: Hawke's bay Anniversary Day
regions: [nz_hb]
week: 1
wday: 1
observed: previous_friday(date)
- name: Labour Day
regions: [nz]
week: 4
wday: 1
- name: Marlborough Anniversary Day
regions: [nz_mb]
week: 4
wday: 1
observed: next_week(date)
11:
- name: Canterbury Anniversary Day
regions: [nz_ca]
week: 2
wday: 5
- name: Chatham Island Anniversary Day
regions: [nz_ch]
mday: 30
observed: closest_monday(date)
12:
- name: Westland Anniversary Day
regions: [nz_wl]
mday: 1
observed: closest_monday(date)
- name: Christmas Day
regions: [nz]
mday: 25
observed: to_monday_if_weekend(date)
- name: Boxing Day
regions: [nz]
mday: 26
observed: to_weekday_if_boxing_weekend(date)
tests:
- given:
date: '2007-01-01'
regions: ["nz"]
options: ["informal"]
expect:
name: "New Year's Day"
- given:
date: '2007-01-02'
regions: ["nz"]
options: ["informal"]
expect:
name: "Day after New Year's Day"
- given:
date: '2007-02-06'
regions: ["nz"]
options: ["informal"]
expect:
name: "Waitangi Day"
- given:
date: '2007-04-06'
regions: ["nz"]
options: ["informal"]
expect:
name: "Good Friday"
- given:
date: '2007-04-09'
regions: ["nz"]
options: ["informal"]
expect:
name: "Easter Monday"
- given:
date: '2007-04-25'
regions: ["nz"]
options: ["informal"]
expect:
name: "ANZAC Day"
- given:
date: '2007-12-25'
regions: ["nz"]
options: ["informal"]
expect:
name: "Christmas Day"
- given:
date: '2007-12-26'
regions: ["nz"]
options: ["informal"]
expect:
name: "Boxing Day"
- given:
date: '2015-04-25'
regions: ["nz"]
expect:
name: "ANZAC Day"
- given:
date: '2015-04-27'
regions: ["nz"]
options: ["observed"]
expect:
name: "ANZAC Day"
- given:
date: '2016-04-25'
regions: ["nz"]
expect:
name: "ANZAC Day"
- given:
date: '2016-04-25'
regions: ["nz"]
options: ["observed"]
expect:
name: "ANZAC Day"
- given:
date: '2015-02-06'
regions: ["nz"]
expect:
name: "Waitangi Day"
- given:
date: '2015-02-06'
regions: ["nz"]
options: ["observed"]
expect:
name: "Waitangi Day"
- given:
date: '2016-02-06'
regions: ["nz"]
expect:
name: "Waitangi Day"
- given:
date: '2016-02-08'
regions: ["nz"]
options: ["observed"]
expect:
name: "Waitangi Day"
- given:
date: '2016-02-01'
regions: ["nz_ne"]
options: ["observed"]
expect:
name: "Nelson Anniversary Day"
- given:
date: '2017-01-30'
regions: ["nz_ne"]
options: ["observed"]
expect:
name: "Nelson Anniversary Day"
- given:
date: '2018-01-29'
regions: ["nz_ne"]
options: ["observed"]
expect:
name: "Nelson Anniversary Day"
- given:
date: '2019-02-04'
regions: ["nz_ne"]
options: ["observed"]
expect:
name: "Nelson Anniversary Day"
- given:
date: '2016-03-14'
regions: ["nz_ta"]
options: ["observed"]
expect:
name: "Taranaki Anniversary Day"
- given:
date: '2017-03-13'
regions: ["nz_ta"]
options: ["observed"]
expect:
name: "Taranaki Anniversary Day"
- given:
date: '2018-03-12'
regions: ["nz_ta"]
options: ["observed"]
expect:
name: "Taranaki Anniversary Day"
- given:
date: '2019-03-11'
regions: ["nz_ta"]
options: ["observed"]
expect:
name: "Taranaki Anniversary Day"
methods:
closest_monday:
arguments: date
ruby: |
if [1, 2, 3, 4].include?(date.wday)
date -= (date.wday - 1)
elsif 0 == date.wday
date += 1
else
date += 8 - date.wday
end
date
previous_friday:
arguments: date
ruby: |
date - 3
next_week:
arguments: date
ruby: |
date + 7

208
vendor/holidays/definitions/pe.yaml vendored Normal file
View File

@ -0,0 +1,208 @@
# Peruvian holiday definitions for the Ruby Holiday gem.
#
# created: 2016-06-18.
# updated: 2016-06-18.
#
# Sources:
# - http://www.timeanddate.com/holidays/peru/
# - https://en.wikipedia.org/wiki/Public_holidays_in_Peru
#
# Avoided days:
# March equinox
# June Solstice
# September equinox
# All soul's day
# December solstice
# Christmas eve
# Christmas day observed
# New year's eve
#
months:
0:
- name: Jueves Santo
regions: [pe]
function: easter(year)
function_modifier: -3
- name: Viernes Santo
regions: [pe]
function: easter(year)
function_modifier: -2
- name: Pascua
regions: [pe]
function: easter(year)
1:
- name: Año Nuevo
regions: [pe]
mday: 1
- name: Día de los Reyes Magos
regions: [pe]
mday: 6
observed: to_monday_if_sunday(date)
5:
- name: Día del Trabajador
regions: [pe]
mday: 1
- name: Día de la Madre
regions: [pe]
week: 2
wday: 0
type: informal
6:
- name: Día de la Bandera
regions: [pe]
mday: 7
type: informal
- name: Día del Padre
regions: [pe]
week: 3
wday: 0
type: informal
- name: Inti Raymi
regions: [pe]
mday: 24
type: informal
- name: San Pablo y San Pedro
regions: [pe]
mday: 29
7:
- name: Primer Día de la Independencia
regions: [pe]
mday: 28
- name: Segundo Día de la Independencia
regions: [pe]
mday: 29
8:
- name: Santa Rosa de Lima
regions: [pe]
mday: 30
9:
- name: Día de las Fuerzas Armadas
regions: [pe]
mday: 24
type: informal
10:
- name: Batalla de Angamos
regions: [pe]
mday: 8
11:
- name: Todos los Santos
regions: [pe]
mday: 1
12:
- name: Inmaculada Concepción
regions: [pe]
mday: 8
observed: to_monday_if_sunday(date)
- name: Navidad del Señor
regions: [pe]
mday: 25
tests:
- given:
date: '2016-01-01'
regions: ["pe"]
options: ["informal"]
expect:
name: "Año Nuevo"
- given:
date: '2016-01-06'
regions: ["pe"]
options: ["informal"]
expect:
name: "Día de los Reyes Magos"
- given:
date: '2016-03-24'
regions: ["pe"]
options: ["informal"]
expect:
name: "Jueves Santo"
- given:
date: '2016-03-25'
regions: ["pe"]
options: ["informal"]
expect:
name: "Viernes Santo"
- given:
date: '2016-03-27'
regions: ["pe"]
options: ["informal"]
expect:
name: "Pascua"
- given:
date: '2016-05-01'
regions: ["pe"]
options: ["informal"]
expect:
name: "Día del Trabajador"
- given:
date: '2016-05-08'
regions: ["pe"]
options: ["informal"]
expect:
name: "Día de la Madre"
- given:
date: '2016-06-07'
regions: ["pe"]
options: ["informal"]
expect:
name: "Día de la Bandera"
- given:
date: '2016-06-19'
regions: ["pe"]
options: ["informal"]
expect:
name: "Día del Padre"
- given:
date: '2016-06-29'
regions: ["pe"]
options: ["informal"]
expect:
name: "San Pablo y San Pedro"
- given:
date: '2016-07-28'
regions: ["pe"]
options: ["informal"]
expect:
name: "Primer Día de la Independencia"
- given:
date: '2016-07-29'
regions: ["pe"]
options: ["informal"]
expect:
name: "Segundo Día de la Independencia"
- given:
date: '2016-08-30'
regions: ["pe"]
options: ["informal"]
expect:
name: "Santa Rosa de Lima"
- given:
date: '2016-09-24'
regions: ["pe"]
options: ["informal"]
expect:
name: "Día de las Fuerzas Armadas"
- given:
date: '2016-10-08'
regions: ["pe"]
options: ["informal"]
expect:
name: "Batalla de Angamos"
- given:
date: '2016-11-01'
regions: ["pe"]
options: ["informal"]
expect:
name: "Todos los Santos"
- given:
date: '2016-12-08'
regions: ["pe"]
options: ["informal"]
expect:
name: "Inmaculada Concepción"
- given:
date: '2016-12-25'
regions: ["pe"]
options: ["informal"]
expect:
name: "Navidad del Señor"

130
vendor/holidays/definitions/ph.yaml vendored Normal file
View File

@ -0,0 +1,130 @@
# Philippines holiday definitions for the Ruby Holiday gem.
#
# Updated: 2015-03-25 by itsmechlark
# Sources:
# - http://www.gov.ph/2014/07/23/list-of-nationwide-holidays-for-2015/
# - http://www.timeanddate.com/holidays/philippines/
---
months:
0:
- name: Maundy Thursday
regions: [ph]
function: easter(year)
function_modifier: -3
- name: Good Friday
regions: [ph]
function: easter(year)
function_modifier: -2
- name: Holy Saturday
regions: [ph]
function: easter(year)
function_modifier: -1
- name: Easter Sunday
regions: [ph]
function: easter(year)
1:
- name: New Years Day
regions: [ph]
mday: 1
2:
- name: People Power Anniversary
regions: [ph]
mday: 25
type: informal
4:
- name: The Day of Valor
regions: [ph]
mday: 9
5:
- name: Labor Day
regions: [ph]
mday: 1
6:
- name: Independence Day
regions: [ph]
mday: 12
8:
- name: Ninoy Aquino Day
regions: [ph]
mday: 21
- name: National Heroes Day
regions: [ph]
function: ph_heroes_day(year)
11:
- name: All Saints Day
regions: [ph]
mday: 1
type: informal
- name: Bonifacio Day
regions: [ph]
mday: 30
12:
- name: Christmas Day
regions: [ph]
mday: 25
- name: Rizal Day
regions: [ph]
mday: 30
- name: New Year's Eve
regions: [ph]
mday: 31
methods:
ph_heroes_day:
# last Monday of August
arguments: year
ruby: |
date = Date.new(year, 8, -1)
if date.wday != 1
date -= date.wday - 1
end
date
tests:
- given:
date: '2015-04-03'
regions: ["ph"]
expect:
name: "Good Friday"
- given:
date: '2015-04-09'
regions: ["ph"]
expect:
name: "The Day of Valor"
- given:
date: '2015-05-01'
regions: ["ph"]
expect:
name: "Labor Day"
- given:
date: '2015-06-12'
regions: ["ph"]
expect:
name: "Independence Day"
- given:
date: '2015-08-21'
regions: ["ph"]
expect:
name: "Ninoy Aquino Day"
- given:
date: '2015-08-31'
regions: ["ph"]
expect:
name: "National Heroes Day"
- given:
date: '2015-11-30'
regions: ["ph"]
expect:
name: "Bonifacio Day"
- given:
date: '2015-12-25'
regions: ["ph"]
expect:
name: "Christmas Day"
- given:
date: '2015-12-30'
regions: ["ph"]
expect:
name: "Rizal Day"

784
vendor/holidays/definitions/pl.yaml vendored Normal file
View File

@ -0,0 +1,784 @@
# Poland holiday definitions for the Ruby Holiday gem.
#
# Updated: 2011-09-12.
# Source: http://pl.wikipedia.org/wiki/Dni_wolne_od_pracy_w_Polsce
---
months:
0:
- name: Tłusty Czwartek
regions: [pl]
function: easter(year)
function_modifier: -52
type: informal
- name: Ostatki
regions: [pl]
function: easter(year)
function_modifier: -47
type: informal
- name: Środa Popielcowa
regions: [pl]
function: easter(year)
function_modifier: -46
type: informal
- name: Niedziela Palmowa
regions: [pl]
function: easter(year)
function_modifier: -7
type: informal
- name: Wielki Czwartek
regions: [pl]
function: easter(year)
function_modifier: -3
type: informal
- name: Wielki Piątek
regions: [pl]
function: easter(year)
function_modifier: -2
type: informal
- name: Wielka Sobota
regions: [pl]
function: easter(year)
function_modifier: -1
type: informal
- name: Niedziela Wielkanocna
regions: [pl]
function: easter(year)
- name: Poniedziałek Wielkanocny (Lany Poniedziałek)
regions: [pl]
function: easter(year)
function_modifier: 1
- name: Zesłanie Ducha Świętego (Zielone Świątki)
regions: [pl]
function: easter(year)
function_modifier: 49
- name: Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)
regions: [pl]
function: easter(year)
function_modifier: 60
1:
- name: Nowy Rok
regions: [pl]
mday: 1
- name: Objawienie Pańskie (święto Trzech Króli)
regions: [pl]
function: pl_trzech_kroli(year)
- name: Objawienie Pańskie (święto Trzech Króli)
regions: [pl]
function: pl_trzech_kroli_informal(year)
type: informal
- name: Dzień Babci
regions: [pl]
mday: 21
type: informal
- name: Dzień Dziadka
regions: [pl]
mday: 22
type: informal
2:
- name: Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)
regions: [pl]
mday: 2
type: informal
- name: Dzień Zakochanych (Walentynki)
regions: [pl]
mday: 14
type: informal
3:
- name: Dzień Kobiet
regions: [pl]
mday: 8
type: informal
- name: Dzień Mężczyzn
regions: [pl]
mday: 10
type: informal
4:
- name: Prima Aprilis
regions: [pl]
mday: 1
type: informal
- name: Międzynarodowy Dzień Ziemi
regions: [pl]
mday: 22
type: informal
5:
- name: Święto Państwowe (Święto Pracy)
regions: [pl]
mday: 1
- name: Dzień Flagi Rzeczpospolitej Polskiej
regions: [pl]
mday: 2
type: informal
- name: Święto Narodowe Trzeciego Maja
regions: [pl]
mday: 3
6:
- name: Dzień Ojca
regions: [pl]
mday: 23
type: informal
8:
- name: Wniebowzięcie Najświętszej Maryi Panny
regions: [pl]
mday: 15
- name: Święto Wojska Polskiego
regions: [pl]
mday: 15
9:
- name: Dzień Chłopaka
regions: [pl]
mday: 30
type: informal
10:
- name: Dzień Nauczyciela (Dzień Edukacji Narodowej)
regions: [pl]
mday: 14
type: informal
11:
- name: Wszystkich Świętych
regions: [pl]
mday: 1
- name: Dzień Zaduszny
regions: [pl]
mday: 2
type: informal
- name: Narodowe Święto Niepodległości
regions: [pl]
mday: 11
- name: Andrzejki
regions: [pl]
mday: 29
type: informal
12:
- name: Barbórka (Dzień Górnika, Naftowca i Gazownika)
regions: [pl]
mday: 4
type: informal
- name: Mikołajki
regions: [pl]
mday: 6
type: informal
- name: Wigilia Bożego Narodzenia
regions: [pl]
mday: 24
type: informal
- name: pierwszy dzień Bożego Narodzenia
regions: [pl]
mday: 25
- name: drugi dzień Bożego Narodzenia
regions: [pl]
mday: 26
- name: Sylwester
regions: [pl]
mday: 31
type: informal
methods:
pl_trzech_kroli:
# Poland: January 6 is holiday since 2011
arguments: year
ruby: |
year >= 2011 ? 6 : nil
pl_trzech_kroli_informal:
# Poland: January 6 wasn't holiday before 2011
arguments: year
ruby: |
year < 2011 ? 6 : nil
tests:
- given:
date: '2011-01-01'
regions: ["pl"]
expect:
name: "Nowy Rok"
- given:
date: '2011-05-01'
regions: ["pl"]
expect:
name: "Święto Państwowe (Święto Pracy)"
- given:
date: '2011-05-03'
regions: ["pl"]
expect:
name: "Święto Narodowe Trzeciego Maja"
- given:
date: '2011-11-01'
regions: ["pl"]
expect:
name: "Wszystkich Świętych"
- given:
date: '2011-11-11'
regions: ["pl"]
expect:
name: "Narodowe Święto Niepodległości"
- given:
date: '2011-12-25'
regions: ["pl"]
expect:
name: "pierwszy dzień Bożego Narodzenia"
- given:
date: '2011-12-26'
regions: ["pl"]
expect:
name: "drugi dzień Bożego Narodzenia"
- given:
date: '2011-01-21'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Babci"
- given:
date: '2011-01-22'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Dziadka"
- given:
date: '2011-02-02'
regions: ["pl"]
options: ["informal"]
expect:
name: "Ofiarowanie Pańskie (Matki Boskiej Gromnicznej)"
- given:
date: '2011-02-14'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Zakochanych (Walentynki)"
- given:
date: '2010-03-08'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Kobiet"
- given:
date: '2011-03-10'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Mężczyzn"
- given:
date: '2011-04-01'
regions: ["pl"]
options: ["informal"]
expect:
name: "Prima Aprilis"
- given:
date: '2010-04-22'
regions: ["pl"]
options: ["informal"]
expect:
name: "Międzynarodowy Dzień Ziemi"
- given:
date: '2011-05-02'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Flagi Rzeczpospolitej Polskiej"
- given:
date: '2010-06-23'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Ojca"
- given:
date: '2011-09-30'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Chłopaka"
- given:
date: '2011-10-14'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Nauczyciela (Dzień Edukacji Narodowej)"
- given:
date: '2011-11-02'
regions: ["pl"]
options: ["informal"]
expect:
name: "Dzień Zaduszny"
- given:
date: '2011-11-29'
regions: ["pl"]
options: ["informal"]
expect:
name: "Andrzejki"
- given:
date: '2011-12-04'
regions: ["pl"]
options: ["informal"]
expect:
name: "Barbórka (Dzień Górnika, Naftowca i Gazownika)"
- given:
date: '2011-12-06'
regions: ["pl"]
options: ["informal"]
expect:
name: "Mikołajki"
- given:
date: '2011-12-24'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wigilia Bożego Narodzenia"
- given:
date: '2011-12-31'
regions: ["pl"]
options: ["informal"]
expect:
name: "Sylwester"
- given:
date: '2011-01-21'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-01-22'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-02-02'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-02-14'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2010-03-08'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-03-10'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-04-01'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2010-04-22'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-05-02'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2010-06-23'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-09-30'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-10-14'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-11-02'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-11-29'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-12-04'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-12-06'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-12-24'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2011-12-31'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2008-01-06'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2009-01-06'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2010-01-06'
regions: ["pl"]
expect:
holiday: false
- given:
date: '2008-01-06'
regions: ["pl"]
options: ["informal"]
expect:
name: "Objawienie Pańskie (święto Trzech Króli)"
- given:
date: '2009-01-06'
regions: ["pl"]
options: ["informal"]
expect:
name: "Objawienie Pańskie (święto Trzech Króli)"
- given:
date: '2010-01-06'
regions: ["pl"]
options: ["informal"]
expect:
name: "Objawienie Pańskie (święto Trzech Króli)"
- given:
date: '2011-01-06'
regions: ["pl"]
expect:
name: "Objawienie Pańskie (święto Trzech Króli)"
- given:
date: '2012-01-06'
regions: ["pl"]
expect:
name: "Objawienie Pańskie (święto Trzech Króli)"
- given:
date: '2013-01-06'
regions: ["pl"]
expect:
name: "Objawienie Pańskie (święto Trzech Króli)"
- given:
date: '2008-01-31'
regions: ["pl"]
options: ["informal"]
expect:
name: "Tłusty Czwartek"
- given:
date: '2009-02-19'
regions: ["pl"]
options: ["informal"]
expect:
name: "Tłusty Czwartek"
- given:
date: '2010-02-11'
regions: ["pl"]
options: ["informal"]
expect:
name: "Tłusty Czwartek"
- given:
date: '2011-03-03'
regions: ["pl"]
options: ["informal"]
expect:
name: "Tłusty Czwartek"
- given:
date: '2012-02-16'
regions: ["pl"]
options: ["informal"]
expect:
name: "Tłusty Czwartek"
- given:
date: '2008-02-05'
regions: ["pl"]
options: ["informal"]
expect:
name: "Ostatki"
- given:
date: '2009-02-24'
regions: ["pl"]
options: ["informal"]
expect:
name: "Ostatki"
- given:
date: '2010-02-16'
regions: ["pl"]
options: ["informal"]
expect:
name: "Ostatki"
- given:
date: '2011-03-08'
regions: ["pl"]
options: ["informal"]
expect:
name: "Ostatki"
- given:
date: '2012-02-21'
regions: ["pl"]
options: ["informal"]
expect:
name: "Ostatki"
- given:
date: '2008-02-06'
regions: ["pl"]
options: ["informal"]
expect:
name: "Środa Popielcowa"
- given:
date: '2009-02-25'
regions: ["pl"]
options: ["informal"]
expect:
name: "Środa Popielcowa"
- given:
date: '2010-02-17'
regions: ["pl"]
options: ["informal"]
expect:
name: "Środa Popielcowa"
- given:
date: '2011-03-09'
regions: ["pl"]
options: ["informal"]
expect:
name: "Środa Popielcowa"
- given:
date: '2012-02-22'
regions: ["pl"]
options: ["informal"]
expect:
name: "Środa Popielcowa"
- given:
date: '2008-03-16'
regions: ["pl"]
options: ["informal"]
expect:
name: "Niedziela Palmowa"
- given:
date: '2009-04-05'
regions: ["pl"]
options: ["informal"]
expect:
name: "Niedziela Palmowa"
- given:
date: '2010-03-28'
regions: ["pl"]
options: ["informal"]
expect:
name: "Niedziela Palmowa"
- given:
date: '2011-04-17'
regions: ["pl"]
options: ["informal"]
expect:
name: "Niedziela Palmowa"
- given:
date: '2012-04-01'
regions: ["pl"]
options: ["informal"]
expect:
name: "Niedziela Palmowa"
- given:
date: '2008-03-20'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Czwartek"
- given:
date: '2009-04-09'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Czwartek"
- given:
date: '2010-04-01'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Czwartek"
- given:
date: '2011-04-21'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Czwartek"
- given:
date: '2012-04-05'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Czwartek"
- given:
date: '2008-03-21'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Piątek"
- given:
date: '2009-04-10'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Piątek"
- given:
date: '2010-04-02'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Piątek"
- given:
date: '2011-04-22'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Piątek"
- given:
date: '2012-04-06'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielki Piątek"
- given:
date: '2008-03-22'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielka Sobota"
- given:
date: '2009-04-11'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielka Sobota"
- given:
date: '2010-04-03'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielka Sobota"
- given:
date: '2011-04-23'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielka Sobota"
- given:
date: '2012-04-07'
regions: ["pl"]
options: ["informal"]
expect:
name: "Wielka Sobota"
- given:
date: '2008-03-23'
regions: ["pl"]
expect:
name: "Niedziela Wielkanocna"
- given:
date: '2009-04-12'
regions: ["pl"]
expect:
name: "Niedziela Wielkanocna"
- given:
date: '2010-04-04'
regions: ["pl"]
expect:
name: "Niedziela Wielkanocna"
- given:
date: '2011-04-24'
regions: ["pl"]
expect:
name: "Niedziela Wielkanocna"
- given:
date: '2012-04-08'
regions: ["pl"]
expect:
name: "Niedziela Wielkanocna"
- given:
date: '2008-03-24'
regions: ["pl"]
expect:
name: "Poniedziałek Wielkanocny (Lany Poniedziałek)"
- given:
date: '2009-04-13'
regions: ["pl"]
expect:
name: "Poniedziałek Wielkanocny (Lany Poniedziałek)"
- given:
date: '2010-04-05'
regions: ["pl"]
expect:
name: "Poniedziałek Wielkanocny (Lany Poniedziałek)"
- given:
date: '2011-04-25'
regions: ["pl"]
expect:
name: "Poniedziałek Wielkanocny (Lany Poniedziałek)"
- given:
date: '2012-04-09'
regions: ["pl"]
expect:
name: "Poniedziałek Wielkanocny (Lany Poniedziałek)"
- given:
date: '2008-05-11'
regions: ["pl"]
expect:
name: "Zesłanie Ducha Świętego (Zielone Świątki)"
- given:
date: '2009-05-31'
regions: ["pl"]
expect:
name: "Zesłanie Ducha Świętego (Zielone Świątki)"
- given:
date: '2010-05-23'
regions: ["pl"]
expect:
name: "Zesłanie Ducha Świętego (Zielone Świątki)"
- given:
date: '2011-06-12'
regions: ["pl"]
expect:
name: "Zesłanie Ducha Świętego (Zielone Świątki)"
- given:
date: '2012-05-27'
regions: ["pl"]
expect:
name: "Zesłanie Ducha Świętego (Zielone Świątki)"
- given:
date: '2008-05-22'
regions: ["pl"]
expect:
name: "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)"
- given:
date: '2009-06-11'
regions: ["pl"]
expect:
name: "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)"
- given:
date: '2010-06-03'
regions: ["pl"]
expect:
name: "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)"
- given:
date: '2011-06-23'
regions: ["pl"]
expect:
name: "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)"
- given:
date: '2012-06-07'
regions: ["pl"]
expect:
name: "Uroczystość Najświętszego Ciała i Krwi Pańskiej (Boże Ciało)"
- given:
date: '2011-08-15'
regions: ["pl"]
expect:
name: "Wniebowzięcie Najświętszej Maryi Panny"

187
vendor/holidays/definitions/pt.yaml vendored Normal file
View File

@ -0,0 +1,187 @@
# Portugese holiday definitions for the Ruby Holiday gem.
#
# Updated: 2014-03-01.
# Sources:
# - http://thomasallen.home.sapo.pt/travel/hols.htm
# - http://en.wikipedia.org/wiki/Holidays_in_Portugal
# - http://www.kidlink.org/KIDPROJ/MCC/mcc0006.html
# - http://www.worldtravelguide.net/country/227/public_holidays/Europe/Portugal.html
# - http://en.wikipedia.org/wiki/Portugal_Day
# - http://www.timeanddate.com/calendar/custom.html?year=2008&country=15
# - http://en.wikipedia.org/wiki/Public_holidays_in_Portugal
#
# Changes 2017-05-31:
# - Add additional holidays for Porto (pt_po) and Lisbon (pt_li)
---
months:
0:
- name: Carnaval # same as Shrove Tuesday
regions: [pt]
function: easter(year)
function_modifier: -47
type: informal
- name: Sexta-feira Santa
regions: [pt]
function: easter(year)
function_modifier: -2
- name: Páscoa
regions: [pt]
function: easter(year)
- name: Corpo de Deus
regions: [pt]
function: easter(year)
function_modifier: 60
1:
- name: Ano Novo
regions: [pt]
mday: 1
4:
- name: Dia da Liberdade
regions: [pt]
mday: 25
5:
- name: Dia do Trabalhador
regions: [pt]
mday: 1
6:
- name: Dia de Portugal
regions: [pt]
mday: 10
- name: Dia de Santo António
regions: [pt_li]
mday: 13
- name: Dia de São João
regions: [pt_po]
mday: 24
8:
- name: Assunção de Nossa Senhora
regions: [pt]
mday: 15
10:
- name: Dia da República
regions: [pt]
mday: 5
11:
- name: Dia de Todos-os-Santos
regions: [pt]
mday: 1
12:
- name: Restauração da Independência
regions: [pt]
mday: 1
- name: Imaculada Conceição
regions: [pt]
mday: 8
- name: Natal
regions: [pt]
mday: 25
tests:
- given:
date: '2008-01-01'
regions: ["pt"]
options: ["informal"]
expect:
name: "Ano Novo"
- given:
date: '2005-02-08'
regions: ["pt"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2006-02-28'
regions: ["pt"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2007-02-20'
regions: ["pt"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2008-02-05'
regions: ["pt"]
options: ["informal"]
expect:
name: "Carnaval"
- given:
date: '2008-03-21'
regions: ["pt"]
options: ["informal"]
expect:
name: "Sexta-feira Santa"
- given:
date: '2008-03-23'
regions: ["pt"]
options: ["informal"]
expect:
name: "Páscoa"
- given:
date: '2016-03-27'
regions: ["pt"]
options: ["informal"]
expect:
name: "Páscoa"
- given:
date: '2008-04-25'
regions: ["pt"]
options: ["informal"]
expect:
name: "Dia da Liberdade"
- given:
date: '2008-05-01'
regions: ["pt"]
options: ["informal"]
expect:
name: "Dia do Trabalhador"
- given:
date: '2016-05-26'
regions: ["pt"]
options: ["informal"]
expect:
name: "Corpo de Deus"
- given:
date: '2008-06-10'
regions: ["pt"]
options: ["informal"]
expect:
name: "Dia de Portugal"
- given:
date: '2008-08-15'
regions: ["pt"]
options: ["informal"]
expect:
name: "Assunção de Nossa Senhora"
- given:
date: '2008-10-05'
regions: ["pt"]
options: ["informal"]
expect:
name: "Dia da República"
- given:
date: '2008-11-01'
regions: ["pt"]
options: ["informal"]
expect:
name: "Dia de Todos-os-Santos"
- given:
date: '2008-12-01'
regions: ["pt"]
options: ["informal"]
expect:
name: "Restauração da Independência"
- given:
date: '2008-12-08'
regions: ["pt"]
options: ["informal"]
expect:
name: "Imaculada Conceição"
- given:
date: '2008-12-25'
regions: ["pt"]
options: ["informal"]
expect:
name: "Natal"

240
vendor/holidays/definitions/ro.yaml vendored Normal file
View File

@ -0,0 +1,240 @@
# Romanian holiday definitions for the Ruby Holiday gem.
#
# Created: 2013-07-23 by Mihai Târnovan
# Sources:
# - http://ro.wikipedia.org/wiki/S%C4%83rb%C4%83tori_publice_%C3%AEn_Rom%C3%A2nia
# - http://en.wikipedia.org/wiki/Public_holidays_in_Romania
#
# Changes 2019-03-11
# - Add Unirea Principatelor Române (since 2017)
# - Add Ziua Copilului (since 2017)
# - Add Vinerea Mare (since 2018)
#
# Sources:
# - https://www.mediafax.ro/politic/legea-prin-care-24-ianuarie-a-fost-declarata-zi-libera-nelucratoare-a-fost-promulgata-de-iohannis-15777292
# - https://www.avocatnet.ro/articol_43954/Din-2017-salaria%C8%9Bii-vor-sta-acas%C4%83-%C8%99i-de-Ziua-Copilului-1-iunie-inclus%C4%83-de-azi-pe-lista-liberelor-legale.html
# - https://www.mediafax.ro/social/iohannis-a-promulgat-legea-prin-care-vinerea-mare-este-sarbatoare-legala-nelucratoare-17058413
---
months:
0:
- name: Paștele - Vinerea Mare # Good Friday
regions: [ro]
function: orthodox_easter(year)
function_modifier: -2
year_ranges:
from: 2018
- name: Paștele - duminică
regions: [ro]
function: orthodox_easter(year)
- name: Paștele - luni
regions: [ro]
function: orthodox_easter(year)
function_modifier: 1
- name: Rusaliile - 50
regions: [ro]
function: orthodox_easter(year)
function_modifier: 49
- name: Rusaliile - 51
regions: [ro]
function: orthodox_easter(year)
function_modifier: 50
1:
- name: Anul nou
regions: [ro]
mday: 1
- name: Anul nou
regions: [ro]
mday: 2
- name: Unirea Principatelor Române
regions: [ro]
mday: 24
year_ranges:
from: 2017
5:
- name: Ziua muncii
regions: [ro]
mday: 1
6:
- name: Ziua Copilului
regions: [ro]
mday: 1
year_ranges:
from: 2017
8:
- name: Adormirea Maicii Domnului
regions: [ro]
mday: 15
11:
- name: Sfântul Apostol Andrei
regions: [ro]
mday: 30
12:
- name: Ziua Națională
regions: [ro]
mday: 1
- name: Sărbătoarea Nașterii Domnului
regions: [ro]
mday: 25
- name: Sărbătoarea Nașterii Domnului
regions: [ro]
mday: 26
tests:
- given:
date: '2017-04-14'
regions: ["ro"]
expect:
holiday: false
- given:
date: '2018-04-06'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - Vinerea Mare"
- given:
date: '2019-04-26'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - Vinerea Mare"
- given:
date: '1961-04-09'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - duminică"
- given:
date: '1961-04-10'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - luni"
- given:
date: '2013-05-05'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - duminică"
- given:
date: '2013-05-06'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - luni"
- given:
date: '2027-05-02'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - duminică"
- given:
date: '2027-05-03'
regions: ["ro"]
options: ["informal"]
expect:
name: "Paștele - luni"
- given:
date: '2012-06-04'
regions: ["ro"]
options: ["informal"]
expect:
name: "Rusaliile - 51"
- given:
date: '2013-06-23'
regions: ["ro"]
options: ["informal"]
expect:
name: "Rusaliile - 50"
- given:
date: '2013-06-24'
regions: ["ro"]
options: ["informal"]
expect:
name: "Rusaliile - 51"
- given:
date: '1986-06-22'
regions: ["ro"]
options: ["informal"]
expect:
name: "Rusaliile - 50"
- given:
date: '1986-06-23'
regions: ["ro"]
options: ["informal"]
expect:
name: "Rusaliile - 51"
- given:
date: '2009-01-01'
regions: ["ro"]
options: ["informal"]
expect:
name: "Anul nou"
- given:
date: '2014-01-02'
regions: ["ro"]
options: ["informal"]
expect:
name: "Anul nou"
- given:
date: '2017-01-24'
regions: ["ro"]
options: ["informal"]
expect:
name: "Unirea Principatelor Române"
- given:
date: '2016-01-24'
regions: ["ro"]
expect:
holiday: false
- given:
date: '2009-05-01'
regions: ["ro"]
options: ["informal"]
expect:
name: "Ziua muncii"
- given:
date: '2017-06-01'
regions: ["ro"]
options: ["informal"]
expect:
name: "Ziua Copilului"
- given:
date: '2016-06-01'
regions: ["ro"]
expect:
holiday: false
- given:
date: '2012-08-15'
regions: ["ro"]
options: ["informal"]
expect:
name: "Adormirea Maicii Domnului"
- given:
date: '2013-11-30'
regions: ["ro"]
options: ["informal"]
expect:
name: "Sfântul Apostol Andrei"
- given:
date: '2013-12-01'
regions: ["ro"]
options: ["informal"]
expect:
name: "Ziua Națională"
- given:
date: '2013-12-25'
regions: ["ro"]
options: ["informal"]
expect:
name: "Sărbătoarea Nașterii Domnului"
- given:
date: '2013-12-26'
regions: ["ro"]
options: ["informal"]
expect:
name: "Sărbătoarea Nașterii Domnului"
- given:
date: '2013-07-23'
regions: ["ro"]
expect:
holiday: false

127
vendor/holidays/definitions/rs_cyrl.yaml vendored Normal file
View File

@ -0,0 +1,127 @@
# Serbian holiday definitions for the Ruby Holiday gem. In Cyrillic.
#
# Updated: 2017-06-09
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Serbia
# - https://de.wikipedia.org/wiki/Feiertage_in_Serbien
# - https://www.timeanddate.com/holidays/serbia/
# - https://www.wko.at/service/aussenwirtschaft/Serbien:-Feiertage-2016.html
# - http://www.lexilogos.com/keyboard/serbian_conversion.htm
---
months:
0:
- name: Велики петак # Good Friday
regions: [rs_cyrl]
function: orthodox_easter(year)
function_modifier: -2
- name: Велика Субота # Holy Saturday
regions: [rs_cyrl]
function: orthodox_easter(year)
function_modifier: -1
- name: Васкрс # Easter Sunday
regions: [rs_cyrl]
function: orthodox_easter(year)
- name: Васкрсни понедељак # Easter Monday
regions: [rs_cyrl]
function: orthodox_easter(year)
function_modifier: 1
1:
- name: Нова Година # New Year's Day
regions: [rs_cyrl]
mday: 1
- name: Нова Година # Day after New Year's Day
regions: [rs_cyrl]
mday: 2
- name: Божић # Christmas Day
regions: [rs_cyrl]
mday: 7
- name: Свети Сава (Савиндан) # Saint Sava Day
regions: [rs_cyrl]
mday: 27
2:
- name: Дан државности Србије # Statehood Day
regions: [rs_cyrl]
mday: 15
- name: Дан државности Србије # Day after Statehood Day
regions: [rs_cyrl]
mday: 16
5:
- name: Празник рада # Worker's Day
regions: [rs_cyrl]
mday: 1
- name: Празник рада # Day after Worker's Day
regions: [rs_cyrl]
mday: 2
- name: Дан победе над фашизмом # Victory Day
regions: [rs_cyrl]
mday: 9
6:
- name: Видовдан # Saint Vitus Day
regions: [rs_cyrl]
mday: 28
11:
- name: Дан примирја # Armistice Day
regions: [rs_cyrl]
mday: 11
tests:
- given:
date: ['2017-1-1', '2017-1-2']
regions: ["rs_cyrl"]
expect:
name: "Нова Година"
- given:
date: '2017-1-7'
regions: ["rs_cyrl"]
expect:
name: "Божић"
- given:
date: '2017-1-27'
regions: ["rs_cyrl"]
expect:
name: "Свети Сава (Савиндан)"
- given:
date: ['2017-2-15', '2017-2-16']
regions: ["rs_cyrl"]
expect:
name: "Дан државности Србије"
- given:
date: ['2017-5-1', '2017-5-2']
regions: ["rs_cyrl"]
expect:
name: "Празник рада"
- given:
date: '2017-5-9'
regions: ["rs_cyrl"]
expect:
name: "Дан победе над фашизмом"
- given:
date: '2017-6-28'
regions: ["rs_cyrl"]
expect:
name: "Видовдан"
- given:
date: '2017-11-11'
regions: ["rs_cyrl"]
expect:
name: "Дан примирја"
- given:
date: ['2017-4-14', '2018-4-6', '2019-4-26']
regions: ["rs_cyrl"]
expect:
name: "Велики петак"
- given:
date: ['2017-4-15', '2018-4-7', '2019-4-27']
regions: ["rs_cyrl"]
expect:
name: "Велика Субота"
- given:
date: ['2017-4-16', '2018-4-8', '2019-4-28']
regions: ["rs_cyrl"]
expect:
name: "Васкрс"
- given:
date: ['2017-4-17', '2018-4-9', '2019-4-29']
regions: ["rs_cyrl"]
expect:
name: "Васкрсни понедељак"

127
vendor/holidays/definitions/rs_la.yaml vendored Normal file
View File

@ -0,0 +1,127 @@
# Serbian holiday definitions for the Ruby Holiday gem. In Latin.
#
# Updated: 2017-06-09
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Serbia
# - https://de.wikipedia.org/wiki/Feiertage_in_Serbien
# - https://www.timeanddate.com/holidays/serbia/
# - https://www.wko.at/service/aussenwirtschaft/Serbien:-Feiertage-2016.html
# - http://www.lexilogos.com/keyboard/serbian_conversion.htm
---
months:
0:
- name: Veliki Petak # Good Friday
regions: [rs_la]
function: orthodox_easter(year)
function_modifier: -2
- name: Velika Subota # Holy Saturday
regions: [rs_la]
function: orthodox_easter(year)
function_modifier: -1
- name: Uskrs # Easter Sunday
regions: [rs_la]
function: orthodox_easter(year)
- name: Vaskrsni ponedeljak # Easter Monday
regions: [rs_la]
function: orthodox_easter(year)
function_modifier: 1
1:
- name: Nova Godina # New Year's Day
regions: [rs_la]
mday: 1
- name: Nova Godina # Day after New Year's Day
regions: [rs_la]
mday: 2
- name: Božić # Christmas Day
regions: [rs_la]
mday: 7
- name: Dan Svetog Save # Saint Sava Day
regions: [rs_la]
mday: 27
2:
- name: Dan državnosti Srbije # Statehood Day
regions: [rs_la]
mday: 15
- name: Dan državnosti Srbije # Day after Statehood Day
regions: [rs_la]
mday: 16
5:
- name: Praznik rada # Worker's Day
regions: [rs_la]
mday: 1
- name: Praznik rada # Day after Worker's Day
regions: [rs_la]
mday: 2
- name: Dan pobede # Victory Day
regions: [rs_la]
mday: 9
6:
- name: Vidovdan # Saint Vitus Day
regions: [rs_la]
mday: 28
11:
- name: Dan primirja # Armistice Day
regions: [rs_la]
mday: 11
tests:
- given:
date: ['2017-1-1', '2017-1-2']
regions: ["rs_la"]
expect:
name: "Nova Godina"
- given:
date: '2017-1-7'
regions: ["rs_la"]
expect:
name: "Božić"
- given:
date: '2017-1-27'
regions: ["rs_la"]
expect:
name: "Dan Svetog Save"
- given:
date: ['2017-2-15', '2017-2-16']
regions: ["rs_la"]
expect:
name: "Dan državnosti Srbije"
- given:
date: ['2017-5-1', '2017-5-2']
regions: ["rs_la"]
expect:
name: "Praznik rada"
- given:
date: '2017-5-9'
regions: ["rs_la"]
expect:
name: "Dan pobede"
- given:
date: '2017-6-28'
regions: ["rs_la"]
expect:
name: "Vidovdan"
- given:
date: '2017-11-11'
regions: ["rs_la"]
expect:
name: "Dan primirja"
- given:
date: ['2017-4-14', '2018-4-6', '2019-4-26']
regions: ["rs_la"]
expect:
name: "Veliki Petak"
- given:
date: ['2017-4-15', '2018-4-7', '2019-4-27']
regions: ["rs_la"]
expect:
name: "Velika Subota"
- given:
date: ['2017-4-16', '2018-4-8', '2019-4-28']
regions: ["rs_la"]
expect:
name: "Uskrs"
- given:
date: ['2017-4-17', '2018-4-9', '2019-4-29']
regions: ["rs_la"]
expect:
name: "Vaskrsni ponedeljak"

108
vendor/holidays/definitions/ru.yaml vendored Normal file
View File

@ -0,0 +1,108 @@
# Russian holiday definitions for the Ruby Holiday gem. In official Cyrillic.
#
# Updated: 2017-06-14
# Sources:
# - https://en.wikipedia.org/wiki/Public_holidays_in_Russia
# - https://de.wikipedia.org/wiki/Feiertage_in_Russland
# - https://translate.yandex.com/?lang=en-ru
# - https://ru.wikipedia.org/wiki/День_Государственного_флага_Российской_Федерации
---
months:
1:
- name: Новый год # New Year's Day
regions: [ru]
mday: 1
- name: Новогодний праздник # 1st New Year holiday
regions: [ru]
mday: 2
- name: Новогодний праздник # 2nd New Year holiday
regions: [ru]
mday: 3
- name: Новогодний праздник # 3rd New Year holiday
regions: [ru]
mday: 4
- name: Новогодний праздник # 4th New Year holiday
regions: [ru]
mday: 5
- name: Рождество Христово # Christmas Day
regions: [ru]
mday: 7
2:
- name: День защитника Отечества # Defender of the Fatherland Day
regions: [ru]
mday: 23
3:
- name: Международный женский день # International Women's Day
regions: [ru]
mday: 8
5:
- name: Праздник Весны и Труда # Spring and Labour Day
regions: [ru]
mday: 1
- name: День Победы # Victory Day
regions: [ru]
mday: 9
6:
- name: День России # Russia Day
regions: [ru]
mday: 12
8:
- name: День Государственного флага Российской Федерации # National Flag Day (official working holiday)
regions: [ru]
mday: 22
11:
- name: День народного единства # Unity Day
regions: [ru]
mday: 4
tests:
- given:
date: '2017-1-1'
regions: ["ru"]
expect:
name: "Новый год"
- given:
date: ['2017-1-2', '2017-1-3', '2017-1-4', '2017-1-5']
regions: ["ru"]
expect:
name: "Новогодний праздник"
- given:
date: '2017-1-7'
regions: ["ru"]
expect:
name: "Рождество Христово"
- given:
date: '2017-2-23'
regions: ["ru"]
expect:
name: "День защитника Отечества"
- given:
date: '2017-3-8'
regions: ["ru"]
expect:
name: "Международный женский день"
- given:
date: '2017-5-1'
regions: ["ru"]
expect:
name: "Праздник Весны и Труда"
- given:
date: '2017-5-9'
regions: ["ru"]
expect:
name: "День Победы"
- given:
date: '2017-6-12'
regions: ["ru"]
expect:
name: "День России"
- given:
date: '2017-8-22'
regions: ["ru"]
expect:
name: "День Государственного флага Российской Федерации"
- given:
date: '2017-11-4'
regions: ["ru"]
expect:
name: "День народного единства"

238
vendor/holidays/definitions/se.yaml vendored Normal file
View File

@ -0,0 +1,238 @@
# Swedish holiday definitions for the Ruby Holiday gem.
#
# Updated: 2008-11-28.
# Sources:
# - http://en.wikipedia.org/wiki/Holidays_in_Sweden
# - http://www.worldtravelguide.net/country/269/public_holidays/Europe/Sweden.html
# - http://hem.passagen.se/farila/midsum.htm
# - http://www.timeanddate.com/calendar/?country=21
---
months:
0:
- name: Långfredagen
regions: [se]
function: easter(year)
function_modifier: -2
- name: Påskafton
regions: [se]
function: easter(year)
function_modifier: -1
type: informal
- name: Påskdagen
regions: [se]
function: easter(year)
- name: Annandag påsk
regions: [se]
function: easter(year)
function_modifier: 1
- name: Kristi himmelsfärdsdag # Ascension Day
regions: [se]
function: easter(year)
function_modifier: 39
- name: Pingstdagen # Whitsunday
regions: [se]
function: easter(year)
function_modifier: 49
- name: Alla helgons dag # All Saint's Day
regions: [se]
function: se_alla_helgons_dag(year)
1:
- name: Nyårsdagen
regions: [se]
mday: 1
- name: Trettondedag jul
regions: [se]
mday: 6
5:
- name: Första maj
regions: [se]
mday: 1
6:
- name: Nationaldagen
regions: [se]
mday: 6
- name: Midsommardagen
regions: [se]
function: se_midsommardagen(year)
- name: Midsommarafton
regions: [se]
function: se_midsommardagen(year)
function_modifier: -1
type: informal
12:
- name: Julafton
regions: [se]
mday: 24
type: informal
- name: Juldagen
regions: [se]
mday: 25
- name: Annandag jul
regions: [se]
mday: 26
- name: Nyårsafton
regions: [se]
mday: 31
type: informal
methods:
se_midsommardagen:
# Sweden: Mid-summer (Saturday between June 2026)
arguments: year
ruby: |
date = Date.civil(year,6,20)
date += (6 - date.wday)
date
se_alla_helgons_dag:
# Sweden: All Saint's Day (Saturday between Oct 31 and Nov 6)
arguments: year
ruby: |
date = Date.civil(year,10,31)
date += (6 - date.wday)
date
tests:
- given:
date: '2008-01-01'
regions: ["se"]
options: ["informal"]
expect:
name: "Nyårsdagen"
- given:
date: '2008-01-06'
regions: ["se"]
options: ["informal"]
expect:
name: "Trettondedag jul"
- given:
date: '2008-03-21'
regions: ["se"]
options: ["informal"]
expect:
name: "Långfredagen"
- given:
date: '2008-03-22'
regions: ["se"]
options: ["informal"]
expect:
name: "Påskafton"
- given:
date: '2008-03-23'
regions: ["se"]
options: ["informal"]
expect:
name: "Påskdagen"
- given:
date: '2008-03-24'
regions: ["se"]
options: ["informal"]
expect:
name: "Annandag påsk"
- given:
date: '2008-05-01'
regions: ["se"]
options: ["informal"]
expect:
name: "Kristi himmelsfärdsdag"
- given:
date: '2008-05-11'
regions: ["se"]
options: ["informal"]
expect:
name: "Pingstdagen"
- given:
date: '2008-06-06'
regions: ["se"]
options: ["informal"]
expect:
name: "Nationaldagen"
- given:
date: '2005-06-25'
regions: ["se"]
options: ["informal"]
expect:
name: "Midsommardagen"
- given:
date: '2006-06-24'
regions: ["se"]
options: ["informal"]
expect:
name: "Midsommardagen"
- given:
date: '2006-06-23'
regions: ["se"]
options: ["informal"]
expect:
name: "Midsommarafton"
- given:
date: '2007-06-23'
regions: ["se"]
options: ["informal"]
expect:
name: "Midsommardagen"
- given:
date: '2007-06-22'
regions: ["se"]
options: ["informal"]
expect:
name: "Midsommarafton"
- given:
date: '2008-06-21'
regions: ["se"]
options: ["informal"]
expect:
name: "Midsommardagen"
- given:
date: '2008-06-20'
regions: ["se"]
options: ["informal"]
expect:
name: "Midsommarafton"
- given:
date: '2005-11-05'
regions: ["se"]
options: ["informal"]
expect:
name: "Alla helgons dag"
- given:
date: '2006-11-04'
regions: ["se"]
options: ["informal"]
expect:
name: "Alla helgons dag"
- given:
date: '2007-11-03'
regions: ["se"]
options: ["informal"]
expect:
name: "Alla helgons dag"
- given:
date: '2008-11-01'
regions: ["se"]
options: ["informal"]
expect:
name: "Alla helgons dag"
- given:
date: '2008-12-24'
regions: ["se"]
options: ["informal"]
expect:
name: "Julafton"
- given:
date: '2008-12-25'
regions: ["se"]
options: ["informal"]
expect:
name: "Juldagen"
- given:
date: '2008-12-26'
regions: ["se"]
options: ["informal"]
expect:
name: "Annandag jul"
- given:
date: '2008-12-31'
regions: ["se"]
options: ["informal"]
expect:
name: "Nyårsafton"

90
vendor/holidays/definitions/sg.yaml vendored Normal file
View File

@ -0,0 +1,90 @@
# Singapore holiday definitions for the Holidays gem!
# Days not included in the definitions (yet):
# Vesak Day (falls on the first full moon in May)
# Lunar New Year (falls on the first day of the Lunar Calendar)
# Hari Raya Puasa and Hari Raya Haji (based on moon sightings, Islamic Calendar)
# Deepavali (15th Day of September or October, based on the Hindu Calendar)
# Source:
# http://publicholidays.sg/
months:
0:
- name: Good Friday
regions: [sg]
function: easter(year)
function_modifier: -2
1:
- name: New Year's Day
regions: [sg]
mday: 1
observed: to_weekday_if_weekend(date)
2:
- name: Valentine's Day
regions: [sg]
mday: 14
type: informal
- name: Total Defence Day
regions: [sg]
mday: 15
type: informal
5:
- name: Labour Day
regions: [sg]
mday: 1
8:
- name: National Day
regions: [sg]
mday: 9
observed: to_weekday_if_weekend(date)
12:
- name: Christmas Day
regions: [sg]
mday: 25
observed: to_weekday_if_weekend(date)
tests:
- given:
date: '2014-01-01'
regions: ["sg"]
options: ["informal"]
expect:
name: "New Year's Day"
- given:
date: '2014-02-14'
regions: ["sg"]
options: ["informal"]
expect:
name: "Valentine's Day"
- given:
date: '2014-02-15'
regions: ["sg"]
options: ["informal"]
expect:
name: "Total Defence Day"
- given:
date: '2014-04-18'
regions: ["sg"]
options: ["informal"]
expect:
name: "Good Friday"
- given:
date: '2014-05-01'
regions: ["sg"]
options: ["informal"]
expect:
name: "Labour Day"
- given:
date: '2014-08-09'
regions: ["sg"]
options: ["informal"]
expect:
name: "National Day"
- given:
date: '2014-12-25'
regions: ["sg"]
options: ["informal"]
expect:
name: "Christmas Day"

159
vendor/holidays/definitions/si.yaml vendored Normal file
View File

@ -0,0 +1,159 @@
# Slovenia holiday definitions for the Ruby Holiday gem.
#
# Updated: 2014-04-09.
# Sources:
# - http://en.wikipedia.org/wiki/Public_holidays_in_Slovenia
months:
0:
- name: velikonočna nedelja
regions: [si]
function: easter(year)
- name: velikonočni ponedeljek
regions: [si]
function: easter(year)
function_modifier: 1
- name: binkošti
regions: [si]
function: easter(year)
function_modifier: 49
1:
- name: novo leto
regions: [si]
mday: 1
2:
- name: Prešernov dan, slovenski kulturni praznik
regions: [si]
mday: 8
4:
- name: dan upora proti okupatorju
regions: [si]
mday: 27
5:
- name: praznik dela
regions: [si]
mday: 1
- name: praznik dela
regions: [si]
mday: 2
6:
- name: dan državnosti
regions: [si]
mday: 25
8:
- name: Marijino vnebovzetje
regions: [si]
mday: 15
10:
- name: dan reformacije
regions: [si]
mday: 31
11:
- name: dan spomina na mrtve
regions: [si]
mday: 1
12:
- name: božič
regions: [si]
mday: 25
- name: dan samostojnosti in enotnosti
regions: [si]
mday: 26
tests:
- given:
date: '2015-04-05'
regions: ["si"]
expect:
name: "velikonočna nedelja"
- given:
date: '2016-03-27'
regions: ["si"]
expect:
name: "velikonočna nedelja"
- given:
date: '2015-04-06'
regions: ["si"]
expect:
name: "velikonočni ponedeljek"
- given:
date: '2016-03-28'
regions: ["si"]
expect:
name: "velikonočni ponedeljek"
- given:
date: '2015-05-24'
regions: ["si"]
expect:
name: "binkošti"
- given:
date: '2016-05-15'
regions: ["si"]
expect:
name: "binkošti"
- given:
date: ["2014-01-01", "2015-01-01", "2016-01-01", "2017-01-01", "2018-01-01", "2019-01-01", "2020-01-01"]
regions: ["si"]
options: ["informal"]
expect:
name: "novo leto"
- given:
date: ["2014-02-08", "2015-02-08", "2016-02-08", "2017-02-08", "2018-02-08", "2019-02-08", "2020-02-08"]
regions: ["si"]
options: ["informal"]
expect:
name: "Prešernov dan, slovenski kulturni praznik"
- given:
date: ["2014-04-27", "2015-04-27", "2016-04-27", "2017-04-27", "2018-04-27", "2019-04-27", "2020-04-27"]
regions: ["si"]
options: ["informal"]
expect:
name: "dan upora proti okupatorju"
- given:
date: ["2014-05-01", "2015-05-01", "2016-05-01", "2017-05-01", "2018-05-01", "2019-05-01", "2020-05-01"]
regions: ["si"]
options: ["informal"]
expect:
name: "praznik dela"
- given:
date: ["2014-05-02", "2015-05-02", "2016-05-02", "2017-05-02", "2018-05-02", "2019-05-02", "2020-05-02"]
regions: ["si"]
options: ["informal"]
expect:
name: "praznik dela"
- given:
date: ["2014-06-25", "2015-06-25", "2016-06-25", "2017-06-25", "2018-06-25", "2019-06-25", "2020-06-25"]
regions: ["si"]
options: ["informal"]
expect:
name: "dan državnosti"
- given:
date: ["2014-08-15", "2015-08-15", "2016-08-15", "2017-08-15", "2018-08-15", "2019-08-15", "2020-08-15"]
regions: ["si"]
options: ["informal"]
expect:
name: "Marijino vnebovzetje"
- given:
date: ["2014-10-31", "2015-10-31", "2016-10-31", "2017-10-31", "2018-10-31", "2019-10-31", "2020-10-31"]
regions: ["si"]
options: ["informal"]
expect:
name: "dan reformacije"
- given:
date: ["2014-11-01", "2015-11-01", "2016-11-01", "2017-11-01", "2018-11-01", "2019-11-01", "2020-11-01"]
regions: ["si"]
options: ["informal"]
expect:
name: "dan spomina na mrtve"
- given:
date: ["2014-12-25", "2015-12-25", "2016-12-25", "2017-12-25", "2018-12-25", "2019-12-25", "2020-12-25"]
regions: ["si"]
options: ["informal"]
expect:
name: "božič"
- given:
date: '2008-12-26'
regions: ["si"]
options: ["informal"]
expect:
name: "dan samostojnosti in enotnosti"

154
vendor/holidays/definitions/sk.yaml vendored Normal file
View File

@ -0,0 +1,154 @@
# Slovak holiday definitions for the Ruby Holiday gem.
#
# Updated: 2013-12-26.
# Sources:
# - http://sk.wikipedia.org/wiki/Slovensk%C3%A9_%C5%A1t%C3%A1tne_sviatky
---
months:
0:
- name: Veľkonočný pondelok
regions: [sk]
function: easter(year)
function_modifier: 1
- name: Veľký piatok
regions: [sk]
function: easter(year)
function_modifier: -2
1:
- name: Nový rok
regions: [sk]
mday: 1
- name: Zjavenie Pána (Traja králi)
regions: [sk]
mday: 6
5:
- name: Sviatok práce
regions: [sk]
mday: 1
- name: Deň víťazstva nad fašizmom
regions: [sk]
mday: 8
7:
- name: Sviatok svätého Cyrila a svätého Metoda
regions: [sk]
mday: 5
8:
- name: Výročie Slovenského národného povstania
regions: [sk]
mday: 29
9:
- name: Deň Ústavy Slovenskej republiky
regions: [sk]
mday: 1
- name: Sedembolestná Panna Mária
regions: [sk]
mday: 15
11:
- name: Sviatok všetkých svätých
regions: [sk]
mday: 1
- name: Deň boja za slobodu a demokraciu
regions: [sk]
mday: 17
12:
- name: Štedrý deň
regions: [sk]
mday: 24
- name: 1. sviatok vianočný
regions: [sk]
mday: 25
- name: 2. sviatok vianočný
regions: [sk]
mday: 26
tests:
- given:
date: '2013-01-01'
regions: ["sk"]
options: ["informal"]
expect:
name: "Nový rok"
- given:
date: '2013-01-06'
regions: ["sk"]
options: ["informal"]
expect:
name: "Zjavenie Pána (Traja králi)"
- given:
date: '2013-03-29'
regions: ["sk"]
options: ["informal"]
expect:
name: "Veľký piatok"
- given:
date: '2013-04-01'
regions: ["sk"]
options: ["informal"]
expect:
name: "Veľkonočný pondelok"
- given:
date: '2013-05-01'
regions: ["sk"]
options: ["informal"]
expect:
name: "Sviatok práce"
- given:
date: '2013-05-08'
regions: ["sk"]
options: ["informal"]
expect:
name: "Deň víťazstva nad fašizmom"
- given:
date: '2013-07-05'
regions: ["sk"]
options: ["informal"]
expect:
name: "Sviatok svätého Cyrila a svätého Metoda"
- given:
date: '2013-08-29'
regions: ["sk"]
options: ["informal"]
expect:
name: "Výročie Slovenského národného povstania"
- given:
date: '2013-09-01'
regions: ["sk"]
options: ["informal"]
expect:
name: "Deň Ústavy Slovenskej republiky"
- given:
date: '2013-09-15'
regions: ["sk"]
options: ["informal"]
expect:
name: "Sedembolestná Panna Mária"
- given:
date: '2013-11-01'
regions: ["sk"]
options: ["informal"]
expect:
name: "Sviatok všetkých svätých"
- given:
date: '2013-11-17'
regions: ["sk"]
options: ["informal"]
expect:
name: "Deň boja za slobodu a demokraciu"
- given:
date: '2013-12-24'
regions: ["sk"]
options: ["informal"]
expect:
name: "Štedrý deň"
- given:
date: '2013-12-25'
regions: ["sk"]
options: ["informal"]
expect:
name: "1. sviatok vianočný"
- given:
date: '2013-12-26'
regions: ["sk"]
options: ["informal"]
expect:
name: "2. sviatok vianočný"

View File

@ -0,0 +1,9 @@
require 'simplecov'
require 'simplecov-rcov'
SimpleCov.minimum_coverage 100
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
SimpleCov.coverage_dir 'reports/coverage'
SimpleCov.start do
add_filter "/spec/"
add_filter "/.bundle/"
end

View File

@ -0,0 +1,15 @@
---
months:
1:
- name: Test Holiday
regions: [test]
mday: 1
methods:
test:
arguments: year
source: |
true
tests: |
test

View File

@ -0,0 +1,9 @@
---
methods:
test:
arguments: year
source: |
true
tests: |
test

View File

@ -0,0 +1,15 @@
---
months:
1:
- name: Test Holiday
regions: [test]
mday: 1
methods:
test:
arguments: year
source: |
true
tests: |
test

View File

@ -0,0 +1,7 @@
$: << '../lib'
require 'coverage_report'
RSpec.configure do |c|
c.order = :random
end

Some files were not shown because too many files have changed in this diff Show More