Skip to content

Commit

Permalink
Merge branch '#333'
Browse files Browse the repository at this point in the history
  • Loading branch information
ypid committed Jul 1, 2020
2 parents 4360ff7 + d6f65a7 commit 912b95c
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 5 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Contributors
* [emilsivro_]
* [simonpoole_] - Simon Poole
* [jmontane_] - Joan Montané
* [Mortein_] - Kiel Hurley


Thanks very much to all contributors!
Expand Down Expand Up @@ -126,6 +127,7 @@ Thanks very much to all contributors!
.. _emilsivro: https://github.com/emilsivro
.. _simonpoole: https://github.com/simonpoole
.. _jmontane: https://github.com/jmontane
.. _Mortein: https://github.com/Mortein


Supporters
Expand All @@ -134,9 +136,9 @@ Supporters
* `iMi digital`_
* AddisMap_

Thanks for helping by allowing employees to work on the project during work hours!
Thanks for helping by allowing employees work on the project during work hours!

.. _iMi digital: http://www.imi-digital.de/
.. _iMi digital: https://www.imi-digital.de/
.. _AddisMap: https://www.addismap.com/

master_ - unreleased
Expand All @@ -157,6 +159,7 @@ Added
* Greece [hariskar_]
* Ireland [Gerw88_, ypid_]
* Ivory Coast [sommerluk_, ypid_]
* New Zealand [Mortein_]
* Norway [Gazer75_]
* Spain [jmontane_]
* Switzerland [mstock_, emilsivro_, simonpoole_, ypid_]
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ Almost everything from opening_hours definition is supported, as well as some ex
* [Italy][PH-it] (Without the Saint Patron day, see [comment](https://github.com/opening-hours/opening_hours.js/pull/74#issuecomment-76194891))
* [Ivory Coast][PH-ci] (Without the four islamic holidays because they can not be calculated and depend on subjective ad-hoc definition)
* [Netherlands][PH-ne]
* [New Zealand][PH-nz] (Provincial holiday is not handled. See [PR #333](https://github.com/opening-hours/opening_hours.js/pull/333) for details.)
* [Poland][PH-nl]
* [Romania][PH-ro]
* [Russian][PH-ru]
Expand All @@ -522,6 +523,7 @@ Almost everything from opening_hours definition is supported, as well as some ex
* [Ukraine][PH-ua]
* [United states][PH-us] (Some special cases are [currently not handled](https://github.com/opening-hours/opening_hours.js/issues/69#issuecomment-74103181))
* **EXT:** Supports limited calculations based on public holidays (e.g. `Sa,PH -1 day open`). The only two possibilities are currently +1 and -1. All other cases are not handled. This seems to be enough because the only thing which is really used is -1.
* Support for school holidays (`SH 10:00-14:00`).
Expand Down Expand Up @@ -868,5 +870,6 @@ Edit: This does also work on npmjs in this short version … -->
[PH-si]: http://www.vlada.si/o_sloveniji/politicni_sistem/prazniki/
[PH-ua]: https://uk.wikipedia.org/wiki/%D0%A1%D0%B2%D1%8F%D1%82%D0%B0_%D1%82%D0%B0_%D0%BF%D0%B0%D0%BC%27%D1%8F%D1%82%D0%BD%D1%96_%D0%B4%D0%BD%D1%96_%D0%B2_%D0%A3%D0%BA%D1%80%D0%B0%D1%97%D0%BD%D1%96
[PH-us]: https://en.wikipedia.org/wiki/Public_holidays_in_the_United_States
[PH-nz]: https://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand
<!-- }}} -->
2 changes: 1 addition & 1 deletion holidays/es.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PH:
# Andalucía 37.33999,-4.58116
Andalucía:
_nominatim_url: 'https://nominatim.openstreetmap.org/reverse?format=json&lat=37.33999&lon=-4.58116&zoom=18&addressdetails=1&limit=1&accept-language=es,ca'
_state_code: aN
_state_code: an

# Aragón 41.37872,-0.76393
Aragón:
Expand Down
1 change: 1 addition & 0 deletions holidays/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export {default as ie} from "./ie.yaml";
export {default as it} from "./it.yaml";
export {default as nl} from "./nl.yaml";
export {default as no} from "./no.yaml";
export {default as nz} from "./nz.yaml";
export {default as pl} from "./pl.yaml";
export {default as ro} from "./ro.yaml";
export {default as ru} from "./ru.yaml";
Expand Down
23 changes: 23 additions & 0 deletions holidays/nominatim_cache/nz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
place_id: 80915542
licence: Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright
osm_type: way
osm_id: 5181977
lat: '-41.29222820634521'
lon: '174.77630801533115'
display_name: Cuba Mall, Mitchelltown, Te Aro, Wellington, Wellington City, Wellington, 6011, New Zealand
address:
country: New Zealand
country_code: nz
# city: Wellington
# county: Wellington City
# neighbourhood: Mitchelltown
# postcode: 6011
# road: Cuba Mall
# state: Wellington
# suburb: Te Aro
boundingbox:
- '-41.2932647'
- '-41.2912136'
- '174.7757249'
- '174.7768907'
15 changes: 15 additions & 0 deletions holidays/nz.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

_nominatim_url: 'https://nominatim.openstreetmap.org/reverse?format=json&lat=-41.2922255&lon=174.7763033&zoom=16&addressdetails=1&accept-language=en'

PH: # https://en.wikipedia.org/wiki/Public_holidays_in_New_Zealand
- {'name': 'New Year''s Day', 'fixed_date': [1, 1]}
- {'name': 'Day after New Year''s Day', 'fixed_date': [1, 2]}
- {'name': 'Waitangi Day', 'fixed_date': [2, 6]}
- {'name': 'Good Friday', 'variable_date': easter, 'offset': -2}
- {'name': 'Easter Monday', 'variable_date': easter, 'offset': 1}
- {'name': 'Anzac Day', 'fixed_date': [4, 25]}
- {'name': 'Queen''s Birthday', 'variable_date': firstJuneMonday}
- {'name': 'Labour Day', 'variable_date': firstOctoberMonday, 'offset': 21}
- {'name': 'Christmas Day', 'fixed_date': [12, 25]}
- {'name': 'Boxing Day', 'fixed_date': [12, 26]}
5 changes: 4 additions & 1 deletion test.de.log
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,9 @@ With warnings:
With warnings:
*PH <--- (Diese Regel ist nicht sehr aussagekräftig, da kein Zeit Selektor angegeben wurde. Ein Zeit Selektor ist die Komponente die angibt, zu welcher Tageszeit ein Objekt geöffnet hat, zum Beispiel "10:00-19:00". Bitte füge eine Zeitangabe oder einen Kommentar hinzu, um dies zu verbessern.)
"Variable days: Weekday in given week." for "PH": PASSED
With warnings:
*PH <--- (Diese Regel ist nicht sehr aussagekräftig, da kein Zeit Selektor angegeben wurde. Ein Zeit Selektor ist die Komponente die angibt, zu welcher Tageszeit ein Objekt geöffnet hat, zum Beispiel "10:00-19:00". Bitte füge eine Zeitangabe oder einen Kommentar hinzu, um dies zu verbessern.)
"Variable days: New Zealand public holidays." for "PH": PASSED
With warnings:
*PH <--- (Diese Regel ist nicht sehr aussagekräftig, da kein Zeit Selektor angegeben wurde. Ein Zeit Selektor ist die Komponente die angibt, zu welcher Tageszeit ein Objekt geöffnet hat, zum Beispiel "10:00-19:00". Bitte füge eine Zeitangabe oder einen Kommentar hinzu, um dies zu verbessern.)
"Variable days: Ireland public holidays." for "PH": PASSED
Expand Down Expand Up @@ -3156,7 +3159,7 @@ Der optional_conf_parm["tag_key"] fehlt, ist aber notwendig wegen optional_conf_
"Test isEqualTo function" for "Mo 10:00-20:00; We-Fr 10:00-20:01": PASSED
"Test isEqualTo function" for "Mo 10:00-20:00; We-Fr 10:00-19:59": PASSED
"Test isEqualTo function" for "closed; Sa unknown "comment"": PASSED
890/945 tests passed. 55 did not pass.
891/946 tests passed. 55 did not pass.
41 tests where (partly) ignored, sorted by commonness:
* 26: prettifyValue (most of the cases this is used to test if values with selectors in wrong order or wrong symbols (error tolerance) are evaluated correctly)
* 11: not implemented yet
Expand Down
5 changes: 4 additions & 1 deletion test.en.log
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,9 @@ With warnings:
With warnings:
*PH <--- (This rule is not very explicit because there is no time selector being used. A time selector is the part specifying hours when the object is opened, for example "10:00-19:00". Please add a time selector to this rule or use a comment to make it more explicit.)
"Variable days: Weekday in given week." for "PH": PASSED
With warnings:
*PH <--- (This rule is not very explicit because there is no time selector being used. A time selector is the part specifying hours when the object is opened, for example "10:00-19:00". Please add a time selector to this rule or use a comment to make it more explicit.)
"Variable days: New Zealand public holidays." for "PH": PASSED
With warnings:
*PH <--- (This rule is not very explicit because there is no time selector being used. A time selector is the part specifying hours when the object is opened, for example "10:00-19:00". Please add a time selector to this rule or use a comment to make it more explicit.)
"Variable days: Ireland public holidays." for "PH": PASSED
Expand Down Expand Up @@ -2742,7 +2745,7 @@ The optional_conf_parm["tag_key"] is missing, required by optional_conf_parm["ma
"Test isEqualTo function" for "Mo 10:00-20:00; We-Fr 10:00-20:01": PASSED
"Test isEqualTo function" for "Mo 10:00-20:00; We-Fr 10:00-19:59": PASSED
"Test isEqualTo function" for "closed; Sa unknown "comment"": PASSED
924/938 tests passed. 14 did not pass.
925/939 tests passed. 14 did not pass.
41 tests where (partly) ignored, sorted by commonness:
* 26: prettifyValue (most of the cases this is used to test if values with selectors in wrong order or wrong symbols (error tolerance) are evaluated correctly)
* 11: not implemented yet
Expand Down
38 changes: 38 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2449,6 +2449,44 @@ test.addTest('Variable days: Weekday in given week.', [

/* }}} */

/* New Zealand holidays {{{ */
test.addTest('Variable days: New Zealand public holidays.', [
'PH',
], '2020-01-01 0:00', '2022-12-31 23:59', [
[ '2020-01-01 00:00', '2020-01-01 24:00', false, 'New Year\'s Day' ],
[ '2020-01-02 00:00', '2020-01-02 24:00', false, 'Day after New Year\'s Day' ],
[ '2020-02-06 00:00', '2020-02-06 24:00', false, 'Waitangi Day' ],
[ '2020-04-10 00:00', '2020-04-10 24:00', false, 'Good Friday' ],
[ '2020-04-13 00:00', '2020-04-13 24:00', false, 'Easter Monday' ],
[ '2020-04-25 00:00', '2020-04-25 24:00', false, 'Anzac Day' ],
[ '2020-06-01 00:00', '2020-06-01 24:00', false, 'Queen\'s Birthday' ],
[ '2020-10-26 00:00', '2020-10-26 24:00', false, 'Labour Day' ],
[ '2020-12-25 00:00', '2020-12-25 24:00', false, 'Christmas Day' ],
[ '2020-12-26 00:00', '2020-12-26 24:00', false, 'Boxing Day' ],
[ '2021-01-01 00:00', '2021-01-01 24:00', false, 'New Year\'s Day' ],
[ '2021-01-02 00:00', '2021-01-02 24:00', false, 'Day after New Year\'s Day' ],
[ '2021-02-06 00:00', '2021-02-06 24:00', false, 'Waitangi Day' ],
[ '2021-04-02 00:00', '2021-04-02 24:00', false, 'Good Friday' ],
[ '2021-04-05 00:00', '2021-04-05 24:00', false, 'Easter Monday' ],
[ '2021-04-25 00:00', '2021-04-25 24:00', false, 'Anzac Day' ],
[ '2021-06-07 00:00', '2021-06-07 24:00', false, 'Queen\'s Birthday' ],
[ '2021-10-25 00:00', '2021-10-25 24:00', false, 'Labour Day' ],
[ '2021-12-25 00:00', '2021-12-25 24:00', false, 'Christmas Day' ],
[ '2021-12-26 00:00', '2021-12-26 24:00', false, 'Boxing Day' ],
[ '2022-01-01 00:00', '2022-01-01 24:00', false, 'New Year\'s Day' ],
[ '2022-01-02 00:00', '2022-01-02 24:00', false, 'Day after New Year\'s Day' ],
[ '2022-02-06 00:00', '2022-02-06 24:00', false, 'Waitangi Day' ],
[ '2022-04-15 00:00', '2022-04-15 24:00', false, 'Good Friday' ],
[ '2022-04-18 00:00', '2022-04-18 24:00', false, 'Easter Monday' ],
[ '2022-04-25 00:00', '2022-04-25 24:00', false, 'Anzac Day' ],
[ '2022-06-06 00:00', '2022-06-06 24:00', false, 'Queen\'s Birthday' ],
[ '2022-10-24 00:00', '2022-10-24 24:00', false, 'Labour Day' ],
[ '2022-12-25 00:00', '2022-12-25 24:00', false, 'Christmas Day' ],
[ '2022-12-26 00:00', '2022-12-26 24:00', false, 'Boxing Day' ],
], 1000 * 60 * 60 * 24 * 30, 0, false, nominatim_by_loc.nz, 'not last test');

/* }}} */

/* Ireland holidays {{{ */
test.addTest('Variable days: Ireland public holidays.', [
'PH',
Expand Down

0 comments on commit 912b95c

Please sign in to comment.