holidays 3.2.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +18 -9
- data/definitions/README.md +174 -0
- data/definitions/ar.yaml +37 -27
- data/definitions/au.yaml +73 -13
- data/definitions/{be.yaml → be_fr.yaml} +15 -15
- data/definitions/be_nl.yaml +65 -0
- data/definitions/cz.yaml +7 -4
- data/definitions/de.yaml +80 -10
- data/definitions/index.yaml +3 -2
- data/definitions/jp.yaml +20 -3
- data/definitions/nl.yaml +2 -1
- data/definitions/nz.yaml +0 -3
- data/lib/generated_definitions/MANIFEST +2 -0
- data/lib/generated_definitions/REGIONS.rb +1 -1
- data/lib/generated_definitions/ar.rb +9 -6
- data/lib/generated_definitions/au.rb +33 -9
- data/lib/generated_definitions/be_fr.rb +40 -0
- data/lib/generated_definitions/be_nl.rb +40 -0
- data/lib/generated_definitions/de.rb +14 -5
- data/lib/generated_definitions/europe.rb +37 -16
- data/lib/generated_definitions/jp.rb +3 -2
- data/lib/generated_definitions/nl.rb +1 -1
- data/lib/generated_definitions/nz.rb +0 -1
- data/lib/holidays.rb +12 -0
- data/lib/holidays/date_calculator/easter.rb +9 -9
- data/lib/holidays/date_calculator/weekend_modifier.rb +25 -4
- data/lib/holidays/definition/context/generator.rb +1 -1
- data/lib/holidays/definition/repository/holidays_by_month.rb +1 -1
- data/lib/holidays/option/context/parse_options.rb +1 -1
- data/lib/holidays/version.rb +1 -1
- data/test/defs/test_defs_ar.rb +18 -14
- data/test/defs/test_defs_au.rb +29 -2
- data/test/defs/{test_defs_be.rb → test_defs_be_fr.rb} +5 -4
- data/test/defs/test_defs_be_nl.rb +26 -0
- data/test/defs/test_defs_de.rb +25 -4
- data/test/defs/test_defs_europe.rb +44 -6
- data/test/defs/test_defs_jp.rb +8 -0
- data/test/holidays/date_calculator/test_weekend_modifier.rb +10 -0
- data/test/test_all_regions.rb +1 -1
- metadata +11 -6
- data/definitions/SYNTAX.rdoc +0 -111
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 314e234058d757423c0e873ac27f9ce001a54fa0
         | 
| 4 | 
            +
              data.tar.gz: f827b9614cd1037c20153fa2b316d000b784e2f4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3fbe210da7f49b7e8c5d5693e230ee2b5bb46190656be2c99bd28f795bc9e8e8ede109e699ebd87ed7b024ca76cfa6cc34220d2853603296700c8feaf3e95562
         | 
| 7 | 
            +
              data.tar.gz: 66f1d44e7a7fc1c10b84f959dccc5c0710a10f802d0ee9bcdd8b74e7bf526d3be95ee1c36dc4dd2a756086bc3753218d7b87b6f8c872cc252e5cf8ba4e04c21e
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,24 @@ | |
| 1 1 | 
             
            # Ruby Holidays Gem CHANGELOG
         | 
| 2 2 |  | 
| 3 | 
            +
            ## 3.3.0
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            This is the final minor point release in v3.X.X. I am releasing it so that all of the latest definitions can be
         | 
| 6 | 
            +
            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
         | 
| 7 | 
            +
            issue is found that needs to be immediately addressed.
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            * Update public holidays for Argentina (https://github.com/schmierkov)
         | 
| 10 | 
            +
            * Remove redundant `require` from weekend modifier (https://github.com/Eric-Guo)
         | 
| 11 | 
            +
            * FIX: Easter Saturday not a holiday in NZ (https://github.com/ghiculescu)
         | 
| 12 | 
            +
            * FIX: Japan 'Marine Day' for 1996-2002 year ranges (https://github.com/shuhei)
         | 
| 13 | 
            +
            * FIX: Australia calculations for Christmas and Boxing (https://github.com/ghiculescu)
         | 
| 14 | 
            +
            * Add dutch language version of definitions for Belgium (michael.cox@novalex.be)
         | 
| 15 | 
            +
            * Make 'Goede Vrijdag' informal for NL definitions (https://github.com/MathijsK93)
         | 
| 16 | 
            +
            * Add 'Great Friday' to Czech holidays (juris@uol.cz)
         | 
| 17 | 
            +
            * Add new informal holidays for Germany (https://github.com/knut2)
         | 
| 18 | 
            +
            * FIX: correctly check for new `year_range` attribute in holidays by month repository (https://github.com/knut2)
         | 
| 19 | 
            +
            * Add DE-Reformationstag for 2017 (https://github.com/knut2)
         | 
| 20 | 
            +
            * Update Australia QLD definition Queens Bday and Labour Day (https://github.com/ghiculescu)
         | 
| 21 | 
            +
             | 
| 3 22 | 
             
            ## 3.2.0
         | 
| 4 23 |  | 
| 5 24 | 
             
            * add 'valid year' functionality to definitions - https://github.com/holidays/holidays/issues/33 - (thanks to https://github.com/ttwo32)
         | 
    
        data/README.md
    CHANGED
    
    | @@ -14,14 +14,12 @@ To install the gem from RubyGems: | |
| 14 14 |  | 
| 15 15 | 
             
            The Holidays gem is tested on Ruby 2.0.0, 2.1.0, 2.2.0, 2.3.0 and JRuby.
         | 
| 16 16 |  | 
| 17 | 
            +
            The Holidays gem follows [semantic versioning](http://semver.org/). Please take this into account when relying on this gem as a dependency.
         | 
| 18 | 
            +
             | 
| 17 19 | 
             
            ## Time zones
         | 
| 18 20 |  | 
| 19 21 | 
             
            Time zones are ignored.  This library assumes that all dates are within the same time zone.
         | 
| 20 22 |  | 
| 21 | 
            -
            ## Examples
         | 
| 22 | 
            -
             | 
| 23 | 
            -
            For more information, see the notes at the top of the Holidays module.
         | 
| 24 | 
            -
             | 
| 25 23 | 
             
            ### Using the Holidays class
         | 
| 26 24 |  | 
| 27 25 | 
             
            Get all holidays on April 25, 2008 in Australia.
         | 
| @@ -120,15 +118,26 @@ See the [original pull request](https://github.com/alexdunae/holidays/pull/36) f | |
| 120 118 |  | 
| 121 119 | 
             
            ### How to contribute
         | 
| 122 120 |  | 
| 123 | 
            -
             | 
| 121 | 
            +
            #### For definition updates
         | 
| 122 | 
            +
             | 
| 123 | 
            +
            * Edit desired definition YAML file(s) located under `definitions/`. If you are adding a new region be sure to update `definitions/index.yaml` as well
         | 
| 124 | 
            +
            * Run `bundle exec rake generate` to generate updated final definitions (they will be located under `lib/generated_definitions/`)
         | 
| 125 | 
            +
            * Run `bundle exec rake test` to ensure your changes did not introduce errors
         | 
| 126 | 
            +
            * Open a PR with *all* of these changes. You *MUST* include the generated definition files in your PR. There is no automatic process to generated definitions at this time
         | 
| 127 | 
            +
             | 
| 128 | 
            +
            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.
         | 
| 129 | 
            +
             | 
| 130 | 
            +
            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`.
         | 
| 124 131 |  | 
| 125 | 
            -
             | 
| 132 | 
            +
            #### For non-definition functionality
         | 
| 126 133 |  | 
| 127 | 
            -
             | 
| 134 | 
            +
            * Fork the repository
         | 
| 135 | 
            +
            * Make your changes
         | 
| 136 | 
            +
            * Create a PR pointing back to `master`
         | 
| 128 137 |  | 
| 129 | 
            -
             | 
| 138 | 
            +
            Don't worry about versioning, we'll handle it on our end.
         | 
| 130 139 |  | 
| 131 | 
            -
             | 
| 140 | 
            +
            Tests are required. If your PR results in lower test coverage then it will not be accepted.
         | 
| 132 141 |  | 
| 133 142 | 
             
            ### Credits and code
         | 
| 134 143 |  | 
| @@ -0,0 +1,174 @@ | |
| 1 | 
            +
            # Holiday Gem Definition Syntax
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            All holidays are defined in YAML files in the `definitions/` directory. These definition files have three main top-level properties:
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            * `months` - this is the meat! All definitions for months 1-12 are defined here
         | 
| 6 | 
            +
            * `methods` - this contains any custom logic that your definitions require
         | 
| 7 | 
            +
            * `tests` - this contains the tests for your definitions
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            The `months` property is required. The two other properties are not strictly required but are almost always used.
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            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.
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ## Key Words
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            There are some terms that you should be familiar with before we dive into each section:
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            #### `region`
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            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.
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            Please note that before version v1.1.0 the compliance with ISO 3166 was not as strict. There might be cases where an existing region symbol does not match the standard.
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            In addition, some sub-regions do not have a matching ISO 3116 entry. In those cases we attempt to choose symbols that are reasonably clear.
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            Examples: `:us` for USA, `:fr` for France, `:us_dc` for Washington, D.C in USA
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            #### `formal`/`informal`
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            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.
         | 
| 30 | 
            +
             | 
| 31 | 
            +
            `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.
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            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.
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            #### `observed`
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            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.
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            ## Months
         | 
| 40 | 
            +
             | 
| 41 | 
            +
            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.
         | 
| 42 | 
            +
             | 
| 43 | 
            +
            The two required properties are:
         | 
| 44 | 
            +
             | 
| 45 | 
            +
            * `name` - The name of the holiday
         | 
| 46 | 
            +
            * `regions` - One or more region codes (targeted to match [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166))
         | 
| 47 | 
            +
             | 
| 48 | 
            +
            ### Dates defined by a fixed date (e.g. January 1st)
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            * `mday` - A non-negative integer representing day of the month (1 through 31).
         | 
| 51 | 
            +
             | 
| 52 | 
            +
            For example, the following holiday is on the first of January and available in the `:ca`, `:us` and `:au` regions:
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            ```
         | 
| 55 | 
            +
            1:
         | 
| 56 | 
            +
            - name: New Year's Day
         | 
| 57 | 
            +
              regions: [ca, us, au]
         | 
| 58 | 
            +
              mday: 1
         | 
| 59 | 
            +
            ```
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            ### Dates defined by a week number (e.g. first Monday of a month)
         | 
| 62 | 
            +
             | 
| 63 | 
            +
            * `wday` - A non-negative integer representing day of the week (0 = Sunday through 6 = Saturday).
         | 
| 64 | 
            +
            * `week` - A non-negative integer representing week number (1 = first week, 3 = third week, -1 = last week),
         | 
| 65 | 
            +
             | 
| 66 | 
            +
            For example, the following holiday is on the first Monday of September and available in the `:ca` region:
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            ```
         | 
| 69 | 
            +
            9:
         | 
| 70 | 
            +
            - name: Labour Day
         | 
| 71 | 
            +
              regions: [ca]
         | 
| 72 | 
            +
              week: 1
         | 
| 73 | 
            +
              wday: 1
         | 
| 74 | 
            +
            ```
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            ## Methods
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            In addition to defining holidays by day or week, you can create 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.
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            For example, Canada celebrates Victoria Day, which falls on the Monday on or before May 24.  So, under the `methods` property we create a custom method that returns a Date object.
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            ```
         | 
| 83 | 
            +
            methods:
         | 
| 84 | 
            +
              ca_victoria_day: |
         | 
| 85 | 
            +
                def self.ca_victoria_day(year)
         | 
| 86 | 
            +
                  date = Date.civil(year,5,24)
         | 
| 87 | 
            +
                  if date.wday > 1
         | 
| 88 | 
            +
                    date -= (date.wday - 1)
         | 
| 89 | 
            +
                  elsif date.wday == 0
         | 
| 90 | 
            +
                    date -= 6
         | 
| 91 | 
            +
                  end
         | 
| 92 | 
            +
                  date
         | 
| 93 | 
            +
                end
         | 
| 94 | 
            +
            ```
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            This would be represented in `months` entry as:
         | 
| 97 | 
            +
             | 
| 98 | 
            +
            ```
         | 
| 99 | 
            +
            5:
         | 
| 100 | 
            +
            - name: Victoria Day
         | 
| 101 | 
            +
              regions: [ca]
         | 
| 102 | 
            +
              function: ca_victoria_day(year)
         | 
| 103 | 
            +
            ```
         | 
| 104 | 
            +
             | 
| 105 | 
            +
            If a holiday can occur in different months (e.g. Easter) it can go in the '0' month.
         | 
| 106 | 
            +
             | 
| 107 | 
            +
            ```
         | 
| 108 | 
            +
            0:
         | 
| 109 | 
            +
            - name: Easter Monday
         | 
| 110 | 
            +
              regions: [ca]
         | 
| 111 | 
            +
              function: easter(year)+1
         | 
| 112 | 
            +
            ```
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            There are pre-existing methods for highly-used calculations. They are:
         | 
| 115 | 
            +
             | 
| 116 | 
            +
            * `easter(year)` - calculates Easter via Gregorian calendar for a given year
         | 
| 117 | 
            +
            * `orthodox_easter(year)` - calculates Easter via Julian calendar for a given year
         | 
| 118 | 
            +
            * `to_monday_if_sunday(date)` - returns date of the following Monday if the 'date' argument falls on a Sunday
         | 
| 119 | 
            +
            * `to_monday_if_weekend(date)` - returns date of the following Monday if the 'date' argument falls on a weekend (Saturday or Sunday)
         | 
| 120 | 
            +
            * `to_weekday_if_boxing_weekend(date)` - returns nearest following weekday if the 'date' argument falls on Boxing Day
         | 
| 121 | 
            +
            * `to_weekday_if_boxing_weekend_from_year(year)` - calculates nearest weekday following Boxing weekend for given year
         | 
| 122 | 
            +
            * `to_weekday_if_weekend(date)` - returns nearest weekday (Monday or Friday) if 'date' argument falls on a weekend (Saturday or Sunday)
         | 
| 123 | 
            +
             | 
| 124 | 
            +
            *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:
         | 
| 125 | 
            +
             | 
| 126 | 
            +
            ```
         | 
| 127 | 
            +
            0:
         | 
| 128 | 
            +
            - name: Good Friday
         | 
| 129 | 
            +
              regions: [us]
         | 
| 130 | 
            +
              function: easter(year)-2
         | 
| 131 | 
            +
              type: informal
         | 
| 132 | 
            +
            ```
         | 
| 133 | 
            +
             | 
| 134 | 
            +
            ### Calculating observed dates
         | 
| 135 | 
            +
             | 
| 136 | 
            +
            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.
         | 
| 137 | 
            +
             | 
| 138 | 
            +
            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:
         | 
| 139 | 
            +
             | 
| 140 | 
            +
            ```
         | 
| 141 | 
            +
            7:
         | 
| 142 | 
            +
            - name: Canada Day
         | 
| 143 | 
            +
              regions: [ca]
         | 
| 144 | 
            +
              mday: 1
         | 
| 145 | 
            +
              observed: to_monday_if_weekend(date)
         | 
| 146 | 
            +
            ```
         | 
| 147 | 
            +
             | 
| 148 | 
            +
            If a user does not specify `observed` when calling the gem then 1/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.
         | 
| 149 | 
            +
             | 
| 150 | 
            +
            ## Tests
         | 
| 151 | 
            +
             | 
| 152 | 
            +
            All definition files should have tests included.  In the YAML file, tests are just a block of Ruby code:
         | 
| 153 | 
            +
             | 
| 154 | 
            +
            ```
         | 
| 155 | 
            +
            tests: |
         | 
| 156 | 
            +
              {Date.civil(2008,1,1) => 'New Year\'s Day',
         | 
| 157 | 
            +
               Date.civil(2008,3,21) => 'Good Friday',
         | 
| 158 | 
            +
               Date.civil(2008,3,24) => 'Easter Monday',
         | 
| 159 | 
            +
               Date.civil(2008,9,1) => 'Labour Day',
         | 
| 160 | 
            +
               Date.civil(2008,12,25) => 'Christmas Day',
         | 
| 161 | 
            +
               Date.civil(2008,12,26) => 'Boxing Day'}.each do |date, name|
         | 
| 162 | 
            +
                assert_equal name, (Holidays.on(date, :ca, :informal)[0] || {})[:name]
         | 
| 163 | 
            +
              end
         | 
| 164 | 
            +
             | 
| 165 | 
            +
              # Victoria Day
         | 
| 166 | 
            +
              [Date.civil(2004,5,24), Date.civil(2005,5,23), Date.civil(2006,5,22),
         | 
| 167 | 
            +
               Date.civil(2007,5,21), Date.civil(2008,5,19)].each do |date|
         | 
| 168 | 
            +
                assert_equal 'Victoria Day', Holidays.on(date, :ca)[0][:name]
         | 
| 169 | 
            +
              end
         | 
| 170 | 
            +
            ```
         | 
| 171 | 
            +
             | 
| 172 | 
            +
            These tests will be picked up by the `generate` process and written into actual Test::Unit tests that are run when a user executes the test suite.
         | 
| 173 | 
            +
             | 
| 174 | 
            +
            Please please please include tests. Your PR won't be accepted if tests are not included with your changes.
         | 
    
        data/definitions/ar.yaml
    CHANGED
    
    | @@ -1,16 +1,13 @@ | |
| 1 1 | 
             
            # Argentinian holiday definitions for the Ruby Holiday gem.
         | 
| 2 2 | 
             
            #
         | 
| 3 | 
            -
            # Updated:  | 
| 3 | 
            +
            # Updated: 2016-02-26.
         | 
| 4 4 | 
             
            #
         | 
| 5 5 | 
             
            # Sources:
         | 
| 6 6 | 
             
            # - http://en.wikipedia.org/wiki/Public_holidays_in_Argentina
         | 
| 7 | 
            -
            #
         | 
| 7 | 
            +
            # - http://servicios.lanacion.com.ar/feriados/2016
         | 
| 8 8 | 
             
            ---
         | 
| 9 9 | 
             
            months:
         | 
| 10 10 | 
             
              0:
         | 
| 11 | 
            -
              - name: Jueves Santo
         | 
| 12 | 
            -
                regions: [ar]
         | 
| 13 | 
            -
                function: easter(year)-3
         | 
| 14 11 | 
             
              - name: Viernes Santo
         | 
| 15 12 | 
             
                regions: [ar]
         | 
| 16 13 | 
             
                function: easter(year)-2
         | 
| @@ -18,6 +15,13 @@ months: | |
| 18 15 | 
             
              - name: Año Nuevo
         | 
| 19 16 | 
             
                regions: [ar]
         | 
| 20 17 | 
             
                mday: 1
         | 
| 18 | 
            +
              2:
         | 
| 19 | 
            +
              - name: Carnaval
         | 
| 20 | 
            +
                regions: [ar]
         | 
| 21 | 
            +
                mday: 8
         | 
| 22 | 
            +
              - name: Carnaval
         | 
| 23 | 
            +
                regions: [ar]
         | 
| 24 | 
            +
                mday: 9
         | 
| 21 25 | 
             
              3:
         | 
| 22 26 | 
             
              - name: Día Nacional de la Memoria por la Verdad y la Justicia
         | 
| 23 27 | 
             
                regions: [ar]
         | 
| @@ -38,45 +42,51 @@ months: | |
| 38 42 | 
             
                regions: [ar]
         | 
| 39 43 | 
             
                mday: 20
         | 
| 40 44 | 
             
              7:
         | 
| 45 | 
            +
              - name: Feriado puente turístico
         | 
| 46 | 
            +
                regions: [ar]
         | 
| 47 | 
            +
                mday: 8
         | 
| 41 48 | 
             
              - name: Día de la Independencia
         | 
| 42 49 | 
             
                regions: [ar]
         | 
| 43 50 | 
             
                mday: 9
         | 
| 44 51 | 
             
              8:
         | 
| 45 52 | 
             
              - name: Paso a la Inmortalidad del General José de San Martín
         | 
| 46 53 | 
             
                regions: [ar]
         | 
| 47 | 
            -
                 | 
| 48 | 
            -
                wday: 1
         | 
| 54 | 
            +
                mday: 15
         | 
| 49 55 | 
             
              10:
         | 
| 50 56 | 
             
              - name: Día del Respeto a la Diversidad Cultural
         | 
| 51 57 | 
             
                regions: [ar]
         | 
| 52 | 
            -
                 | 
| 53 | 
            -
                wday: 1
         | 
| 58 | 
            +
                mday: 12
         | 
| 54 59 | 
             
              11:
         | 
| 55 | 
            -
              - name: Día de la Soberanía  | 
| 60 | 
            +
              - name: Día de la Soberanía Nacional
         | 
| 56 61 | 
             
                regions: [ar]
         | 
| 57 | 
            -
                 | 
| 58 | 
            -
                wday: 1
         | 
| 62 | 
            +
                mday: 20
         | 
| 59 63 | 
             
              12:
         | 
| 60 64 | 
             
              - name: Inmaculada Concepción de María
         | 
| 61 65 | 
             
                regions: [ar]
         | 
| 62 66 | 
             
                mday: 8
         | 
| 67 | 
            +
              - name: Feriado puente turístico
         | 
| 68 | 
            +
                regions: [ar]
         | 
| 69 | 
            +
                mday: 9
         | 
| 63 70 | 
             
              - name: Navidad
         | 
| 64 71 | 
             
                regions: [ar]
         | 
| 65 72 | 
             
                mday: 25
         | 
| 66 73 | 
             
            tests: |
         | 
| 67 | 
            -
                {Date.civil( | 
| 68 | 
            -
                 Date.civil( | 
| 69 | 
            -
                 Date.civil( | 
| 70 | 
            -
                 Date.civil( | 
| 71 | 
            -
                 Date.civil( | 
| 72 | 
            -
                 Date.civil( | 
| 73 | 
            -
                 Date.civil( | 
| 74 | 
            -
                 Date.civil( | 
| 75 | 
            -
                 Date.civil( | 
| 76 | 
            -
                 Date.civil( | 
| 77 | 
            -
                 Date.civil( | 
| 78 | 
            -
                 Date.civil( | 
| 79 | 
            -
                 Date.civil( | 
| 80 | 
            -
                 Date.civil( | 
| 74 | 
            +
                {Date.civil(2016,1,1) => 'Año Nuevo',
         | 
| 75 | 
            +
                 Date.civil(2016,2,8) => 'Carnaval',
         | 
| 76 | 
            +
                 Date.civil(2016,2,9) => 'Carnaval',
         | 
| 77 | 
            +
                 Date.civil(2016,3,24) => 'Día Nacional de la Memoria por la Verdad y la Justicia',
         | 
| 78 | 
            +
                 Date.civil(2016,3,25) => 'Viernes Santo',
         | 
| 79 | 
            +
                 Date.civil(2016,4,2) => 'Día del Veterano y de los Caídos en la Guerra de Malvinas',
         | 
| 80 | 
            +
                 Date.civil(2016,5,1) => 'Día del Trabajador',
         | 
| 81 | 
            +
                 Date.civil(2016,5,25) => 'Día de la Revolución de Mayo',
         | 
| 82 | 
            +
                 Date.civil(2016,6,20) => 'Día de la Bandera',
         | 
| 83 | 
            +
                 Date.civil(2016,7,8) => 'Feriado puente turístico',
         | 
| 84 | 
            +
                 Date.civil(2016,7,9) => 'Día de la Independencia',
         | 
| 85 | 
            +
                 Date.civil(2016,8,15) => 'Paso a la Inmortalidad del General José de San Martín',
         | 
| 86 | 
            +
                 Date.civil(2016,10,12) => 'Día del Respeto a la Diversidad Cultural',
         | 
| 87 | 
            +
                 Date.civil(2016,11,20) => 'Día de la Soberanía Nacional',
         | 
| 88 | 
            +
                 Date.civil(2016,12,8) => 'Inmaculada Concepción de María',
         | 
| 89 | 
            +
                 Date.civil(2016,12,9) => 'Feriado puente turístico',
         | 
| 90 | 
            +
                 Date.civil(2016,12,25) => 'Navidad'}.each do |date, name|
         | 
| 81 91 | 
             
                  assert_equal name, (Holidays.on(date, :ar, :informal)[0] || {})[:name]
         | 
| 82 | 
            -
                end
         | 
| 92 | 
            +
                end
         | 
    
        data/definitions/au.yaml
    CHANGED
    
    | @@ -4,7 +4,7 @@ | |
| 4 4 | 
             
            # - http://en.wikipedia.org/wiki/Australian_public_holidays
         | 
| 5 5 | 
             
            # - http://www.docep.wa.gov.au/lr/LabourRelations/Content/Wages%20and%20Conditions/Public%20Holidays/Public_Holidays.html
         | 
| 6 6 | 
             
            # - http://www.wst.tas.gov.au/employment_info/public_holidays
         | 
| 7 | 
            -
            #  | 
| 7 | 
            +
            # - https://www.fairwork.gov.au/leave/public-holidays/list-of-public-holidays
         | 
| 8 8 | 
             
            --- 
         | 
| 9 9 | 
             
            months:
         | 
| 10 10 | 
             
              0: 
         | 
| @@ -79,9 +79,12 @@ months: | |
| 79 79 | 
             
                week: 1
         | 
| 80 80 | 
             
                wday: 1
         | 
| 81 81 | 
             
              - name: Queen's Birthday
         | 
| 82 | 
            -
                regions: [au_act, au_nsw, au_sa,  | 
| 82 | 
            +
                regions: [au_act, au_nsw, au_sa, au_tas, au_nt, au_vic]
         | 
| 83 83 | 
             
                week: 2
         | 
| 84 84 | 
             
                wday: 1
         | 
| 85 | 
            +
              - name: Queen's Birthday
         | 
| 86 | 
            +
                regions: [au_qld]
         | 
| 87 | 
            +
                function: qld_queens_birthday_june(year)
         | 
| 85 88 | 
             
              - name: Queensland Day
         | 
| 86 89 | 
             
                regions: [au_qld]
         | 
| 87 90 | 
             
                mday: 6
         | 
| @@ -137,16 +140,26 @@ months: | |
| 137 140 | 
             
                week: 1
         | 
| 138 141 | 
             
                wday: 2
         | 
| 139 142 | 
             
              12: 
         | 
| 140 | 
            -
              - name: Christmas Day
         | 
| 141 | 
            -
                regions: [ | 
| 143 | 
            +
              - name: Christmas Day # CHRISTMAS DAY - ACT, NSW, QLD, Tas, WA observe on 27th (and 25th) if 25th is a Sunday
         | 
| 144 | 
            +
                regions: [au_qld, au_nsw, au_act, au_tas, au_wa]
         | 
| 145 | 
            +
                mday: 25
         | 
| 146 | 
            +
                observed: to_tuesday_if_sunday_or_monday_if_saturday
         | 
| 147 | 
            +
              - name: Christmas Day # CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
         | 
| 148 | 
            +
                regions: [au_sa]
         | 
| 142 149 | 
             
                mday: 25
         | 
| 143 150 | 
             
                observed: to_monday_if_weekend
         | 
| 151 | 
            +
              - name: Christmas Day # CHRISTMAS DAY - Victoria and NT don't observe 25th if weekend - xmas is on the 27th
         | 
| 152 | 
            +
                regions: [au_vic, au_nt]
         | 
| 153 | 
            +
                function: xmas_to_weekday_if_weekend(year)
         | 
| 144 154 | 
             
              - name: Boxing Day
         | 
| 145 155 | 
             
                regions: [au_nsw, au_vic, au_qld, au_act, au_wa]
         | 
| 146 156 | 
             
                mday: 26
         | 
| 147 | 
            -
                observed:  | 
| 157 | 
            +
                observed: to_tuesday_if_sunday_or_monday_if_saturday
         | 
| 148 158 | 
             
              - name: Boxing Day
         | 
| 149 | 
            -
                regions: [au_sa | 
| 159 | 
            +
                regions: [au_sa]
         | 
| 160 | 
            +
                function: to_weekday_if_boxing_weekend_from_year_or_to_tuesday_if_monday(year)
         | 
| 161 | 
            +
              - name: Boxing Day
         | 
| 162 | 
            +
                regions: [au_tas, au_nt]
         | 
| 150 163 | 
             
                function: to_weekday_if_boxing_weekend_from_year(year)
         | 
| 151 164 | 
             
            methods:
         | 
| 152 165 | 
             
              afl_grand_final: |
         | 
| @@ -158,20 +171,39 @@ methods: | |
| 158 171 | 
             
              qld_queens_bday_october: |
         | 
| 159 172 | 
             
                # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
         | 
| 160 173 | 
             
                # celebrated twice in 2012
         | 
| 174 | 
            +
                # in october again from 2016
         | 
| 161 175 | 
             
                def self.qld_queens_bday_october(year)
         | 
| 162 | 
            -
                  year  | 
| 176 | 
            +
                  if year >= 2016
         | 
| 177 | 
            +
                    Holidays.calculate_day_of_month(year, 10, 1, 1)
         | 
| 178 | 
            +
                  elsif year == 2012
         | 
| 179 | 
            +
                    1
         | 
| 180 | 
            +
                  else
         | 
| 181 | 
            +
                    nil
         | 
| 182 | 
            +
                  end
         | 
| 163 183 | 
             
                end
         | 
| 164 184 | 
             
              qld_labour_day_may: |
         | 
| 165 185 | 
             
                # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
         | 
| 166 | 
            -
                #  | 
| 186 | 
            +
                # for 2013 to 2016 it was in October, otherwise it's in May
         | 
| 167 187 | 
             
                def self.qld_labour_day_may(year)
         | 
| 168 | 
            -
                  year  | 
| 188 | 
            +
                  if year < 2013 || year >= 2016
         | 
| 189 | 
            +
                    Holidays.calculate_day_of_month(year, 5, 1, 1)
         | 
| 190 | 
            +
                  end
         | 
| 169 191 | 
             
                end
         | 
| 170 192 | 
             
              qld_labour_day_october: |
         | 
| 171 193 | 
             
                # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
         | 
| 172 | 
            -
                #  | 
| 194 | 
            +
                # for 2013 to 2016 it was in October, otherwise it's in May
         | 
| 173 195 | 
             
                def self.qld_labour_day_october(year)
         | 
| 174 | 
            -
                  year  | 
| 196 | 
            +
                  if year >= 2013 && year < 2016
         | 
| 197 | 
            +
                    Holidays.calculate_day_of_month(year, 10, 1, 1)
         | 
| 198 | 
            +
                  end
         | 
| 199 | 
            +
                end
         | 
| 200 | 
            +
              qld_queens_birthday_june: |
         | 
| 201 | 
            +
                # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
         | 
| 202 | 
            +
                # in june until 2015
         | 
| 203 | 
            +
                def self.qld_queens_birthday_june(year)
         | 
| 204 | 
            +
                  if year <= 2015
         | 
| 205 | 
            +
                    Holidays.calculate_day_of_month(year, 6, 2, 1)
         | 
| 206 | 
            +
                  end
         | 
| 175 207 | 
             
                end
         | 
| 176 208 | 
             
              g20_day_2014_only: |
         | 
| 177 209 | 
             
                # http://www.justice.qld.gov.au/fair-and-safe-work/industrial-relations/public-holidays/dates
         | 
| @@ -211,8 +243,7 @@ tests: | | |
| 211 243 | 
             
                 Date.civil(2007,1,26) => 'Australia Day', 
         | 
| 212 244 | 
             
                 Date.civil(2007,4,6) => 'Good Friday',
         | 
| 213 245 | 
             
                 Date.civil(2007,4,9) => 'Easter Monday',
         | 
| 214 | 
            -
                 Date.civil(2007,4,25) => 'ANZAC Day',
         | 
| 215 | 
            -
                 Date.civil(2007,12,25) => 'Christmas Day'}.each do |date, name|
         | 
| 246 | 
            +
                 Date.civil(2007,4,25) => 'ANZAC Day'}.each do |date, name|
         | 
| 216 247 | 
             
                  assert_equal name, (Holidays.on(date, :au, :informal)[0] || {})[:name]
         | 
| 217 248 | 
             
                end
         | 
| 218 249 |  | 
| @@ -236,10 +267,14 @@ tests: | | |
| 236 267 |  | 
| 237 268 | 
             
                assert_equal 'Labour Day', Holidays.on(Date.civil(2013,10,7), :au_qld)[0][:name]
         | 
| 238 269 | 
             
                assert_equal 'Labour Day', Holidays.on(Date.civil(2012,5,7), :au_qld)[0][:name]
         | 
| 270 | 
            +
                assert_equal 'Labour Day', Holidays.on(Date.civil(2015,10,5), :au_qld)[0][:name]
         | 
| 271 | 
            +
                assert_equal 'Labour Day', Holidays.on(Date.civil(2016,5,2), :au_qld)[0][:name]
         | 
| 239 272 |  | 
| 240 273 | 
             
                assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,6,11), :au_qld)[0][:name]
         | 
| 241 274 | 
             
                assert_equal "Queen's Birthday", Holidays.on(Date.civil(2012,10,1), :au_qld)[0][:name]
         | 
| 242 275 | 
             
                assert_equal "Queen's Birthday", Holidays.on(Date.civil(2013,6,10), :au_qld)[0][:name]
         | 
| 276 | 
            +
                assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015,6,8), :au_qld)[0][:name]
         | 
| 277 | 
            +
                assert_equal "Queen's Birthday", Holidays.on(Date.civil(2016,10,3), :au_qld)[0][:name]
         | 
| 243 278 |  | 
| 244 279 | 
             
                assert_equal "Queen's Birthday", Holidays.on(Date.civil(2014, 9, 29), :au_wa)[0][:name]
         | 
| 245 280 | 
             
                assert_equal "Queen's Birthday", Holidays.on(Date.civil(2015, 9, 28), :au_wa)[0][:name]
         | 
| @@ -308,3 +343,28 @@ tests: | | |
| 308 343 | 
             
                assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2014, 2, 10), :au_tas_south)[0][:name]
         | 
| 309 344 | 
             
                assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2015, 2, 9), :au_tas_south)[0][:name]
         | 
| 310 345 | 
             
                assert_equal 'Royal Hobart Regatta', Holidays.on(Date.civil(2016, 2, 8), :au_tas_south)[0][:name]
         | 
| 346 | 
            +
             | 
| 347 | 
            +
                # CHRISTMAS DAY - ACT, NSW, QLD, Tas, WA observe on 27th (and 25th) if 25th is a Sunday
         | 
| 348 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_qld)[0][:name]
         | 
| 349 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_qld, :observed)[0][:name]
         | 
| 350 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_nsw)[0][:name]
         | 
| 351 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nsw, :observed)[0][:name]
         | 
| 352 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_act)[0][:name]
         | 
| 353 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_act, :observed)[0][:name]
         | 
| 354 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_tas)[0][:name]
         | 
| 355 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_tas, :observed)[0][:name]
         | 
| 356 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_wa)[0][:name]
         | 
| 357 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_wa, :observed)[0][:name]
         | 
| 358 | 
            +
             | 
| 359 | 
            +
                # CHRISTMAS DAY - SA observes on 26th if 25th is a Sunday (Boxing Day goes to 27th)
         | 
| 360 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 25).holidays(:au_sa)[0][:name]
         | 
| 361 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 26).holidays(:au_sa, :observed)[0][:name]
         | 
| 362 | 
            +
                assert_equal "Boxing Day", Date.civil(2016, 12, 27).holidays(:au_sa)[0][:name]
         | 
| 363 | 
            +
             | 
| 364 | 
            +
                # CHRISTMAS DAY - Victoria and NT don't observe 25th if weekend - xmas is on the 27th
         | 
| 365 | 
            +
                assert_nil Date.civil(2016, 12, 25).holidays(:au_vic)[0]
         | 
| 366 | 
            +
                assert_nil Date.civil(2016, 12, 25).holidays(:au_nt)[0]
         | 
| 367 | 
            +
                assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_vic)[0][:name]
         | 
| 368 | 
            +
                assert_equal "Boxing Day", Date.civil(2016, 12, 26).holidays(:au_nt)[0][:name]
         | 
| 369 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_vic)[0][:name]
         | 
| 370 | 
            +
                assert_equal "Christmas Day", Date.civil(2016, 12, 27).holidays(:au_nt)[0][:name]
         |