Skip to content

Commit b9b48f0

Browse files
feat(holidays): migrate school holidays to OpenHolidays data
Migrate school holiday data from manually maintained YAML files to automated generation from OpenHolidays Git submodule, expanding coverage from 8 to 33 countries. Implementation: - Add openholidaysapi.data as Git submodule - Create fetch-school-holidays.mjs to parse CSV files from submodule - Generate subdivision entries using full names from subdivisions.csv - Merge generated SH data with existing YAML PH data - Add export validation for index.js Migrated countries (8): at, be, de, fr, hr, hu, lu, ro New countries (25): ad, al, bg, by, ch, ci, cz, dk, ee, es, ie, it, li, lt, lv, mc, md, mt, mx, nl, pl, pt, rs, si, sk, sm, za Tests updated from 2014-2015 to 2024-2025 timeframe. Update data: node scripts/fetch-school-holidays.mjs
1 parent 59ffe43 commit b9b48f0

24 files changed

+15752
-4718
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "submodules/YoHours"]
22
path = submodules/YoHours
33
url = https://framagit.org/PanierAvide/YoHours.git
4+
[submodule "submodules/openholidaysapi.data"]
5+
path = submodules/openholidaysapi.data
6+
url = https://github.com/openpotato/openholidaysapi.data.git

CONTRIBUTING.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,13 @@ We use a branching model inspired by Gitflow:
2929
When the `develop` branch is deemed ready for a new release:
3030

3131
1. A maintainer prepares the release in a `release/` branch based on `develop`.
32-
2. The maintainer runs `make release-prepare` locally.
33-
2. The maintainer decides if a release candidate should be released, if rc `npx commit-and-tag-version --prerelease=rc` should be run locally, if not `make release-local` should be run. In case a maintainer does not have a separate OpenSSH/OpenPGP key for releases, they can use their regular signing key. The maintainer pushes the signed git tag to their repo fork.
34-
2. This pull request will be reviewed and then merged into `develop`
35-
3. The maintainer creates a new pull request from `develop` to `main`.
36-
5. ypid who is currently the only one who can release to npmjs.com gets assigned the pull requests, pulls the signed git tag and runs `make release-publish` on their machine and finally merges the pull request.
37-
4. ypid creates a release on GitHub and marks it as latest.
32+
2. The maintainer updates school holiday data: `node scripts/fetch-school-holidays.mjs` and commits any changes.
33+
3. The maintainer runs `make release-prepare` locally.
34+
4. The maintainer decides if a release candidate should be released, if rc `npx commit-and-tag-version --prerelease=rc` should be run locally, if not `make release-local` should be run. In case a maintainer does not have a separate OpenSSH/OpenPGP key for releases, they can use their regular signing key. The maintainer pushes the signed git tag to their repo fork.
35+
5. This pull request will be reviewed and then merged into `develop`
36+
6. The maintainer creates a new pull request from `develop` to `main`.
37+
7. ypid who is currently the only one who can release to npmjs.com gets assigned the pull requests, pulls the signed git tag and runs `make release-publish` on their machine and finally merges the pull request.
38+
8. ypid creates a release on GitHub and marks it as latest.
3839

3940
## Translation Contributions
4041

README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -611,17 +611,13 @@ Almost everything from opening_hours definition is supported, as well as some ex
611611

612612
- Support for school holidays (`SH 10:00-14:00`).
613613

614-
- Countries with SH definition:
615-
616-
- Austria (national until 2024, regional until 2021)
617-
- Belgium (good until 2026)
618-
- Croatia (good until 2022–2023)
619-
- France (good until 2025)
620-
- Germany, see [hc] and [scripts/update_german_sh.mjs](scripts/update_german_sh.mjs) (good until 2026)
621-
- Greece (good until 2020)
622-
- Hungary (good until 2024–2025)
623-
- Luxembourg (good until 2025–2026)
624-
- Romania (good until 2021)
614+
School holidays are automatically sourced from the [OpenHolidays API](https://openholidaysapi.org) for 33 countries (from 2020 onwards). Update data by running:
615+
616+
```bash
617+
node scripts/fetch-school-holidays.mjs
618+
```
619+
620+
For details see [src/holidays/README.md](src/holidays/README.md).
625621

626622
- There can be two cases which need to be separated (this applies for PH and SH):
627623

@@ -876,7 +872,6 @@ Edit: This does also work on npmjs in this short version … -->
876872
[ohlib.library-api]: #library-api
877873
[ohlib.npmjs]: https://www.npmjs.org/package/opening_hours
878874
[ohlib.github]: https://github.com/opening-hours/opening_hours.js
879-
[hc]: https://gitlab.com/ypid/hc
880875
[evaluation tool]: https://openingh.openstreetmap.de/evaluation_tool/
881876
[ph-ar]: https://en.wikipedia.org/wiki/Public_holidays_in_Argentina
882877
[ph-at]: https://de.wikipedia.org/wiki/Feiertage_in_%C3%96sterreich

eslint.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import stylistic from '@stylistic/eslint-plugin'
66
import tseslint from 'typescript-eslint'
77

88
export default defineConfig([
9-
globalIgnores(['build/*', 'submodules/*', '**/yohours_model.js']),
9+
globalIgnores(['build/*', 'submodules/*', '**/yohours_model.js', 'src/holidays/generated-openholidays.js']),
1010
{
1111
files: ['**/*.js', '**/*.mjs'],
1212
extends: [js.configs.recommended],

rollup.config.mjs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,10 @@ import nodeResolve from '@rollup/plugin-node-resolve';
33
import terser from '@rollup/plugin-terser';
44
import yaml from '@rollup/plugin-yaml';
55

6-
function recursivelyDeleteNominatimUrl(data) {
7-
if (typeof data === 'object') {
8-
Object.values(data).forEach(recursivelyDeleteNominatimUrl);
9-
}
10-
delete data._nominatim_url;
11-
return data;
12-
}
13-
6+
// YAML plugin only for non-holiday files (e.g., word_error_correction.yaml)
7+
// Holiday data now comes from generated-openholidays.js
148
const yamlPlugin = yaml({
15-
transform(data) {
16-
return recursivelyDeleteNominatimUrl(data);
17-
}
9+
include: ['**/*.yaml', '!**/holidays/*.yaml']
1810
});
1911

2012
const terserConfig = {

0 commit comments

Comments
 (0)