verified_holidays 0.1.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 +7 -0
- data/CHANGELOG.md +14 -0
- data/LICENSE +21 -0
- data/README.md +110 -0
- data/data/holidays.yml +1068 -0
- data/lib/verified_holidays/cabinet_office.rb +44 -0
- data/lib/verified_holidays/dataset.rb +63 -0
- data/lib/verified_holidays/holiday.rb +51 -0
- data/lib/verified_holidays/holiday_jp_compat.rb +10 -0
- data/lib/verified_holidays/verifier.rb +63 -0
- data/lib/verified_holidays/version.rb +5 -0
- data/lib/verified_holidays.rb +29 -0
- metadata +72 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8bf224234d064575a5e2d60e74f9aac823e62e71fd28389ea0b1be39e380fa6c
|
|
4
|
+
data.tar.gz: 1e3f31e88cbec4989403d3078541e272f18a0da9f3ade17268ffc4ab748f099a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: f2a5466e749d0bb1b4a53cfe37750a6769eb8aa7aafa81f3849c6fdad67bde357f11ea6a83a4bdcbf8dd314dd065e5993680419c0b708e50c43e17cdae1ec066
|
|
7
|
+
data.tar.gz: 0e914bc27a8658f5e545faec361560fda9326c8bbedfcd90555ab324137b3f5886e37e7a3c35782f6a8edbdc3006e559dbc420dfc4daf83b372e4f571fc6dbb2
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-03-20
|
|
4
|
+
|
|
5
|
+
- Initial release as `verified_holidays` (previously developed as `shukujitsu`)
|
|
6
|
+
- `VerifiedHolidays.holiday?` — check if a date is a Japanese national holiday
|
|
7
|
+
- `VerifiedHolidays.between` — list holidays in a date range
|
|
8
|
+
- `VerifiedHolidays.name` — get the holiday name for a date
|
|
9
|
+
- `VerifiedHolidays.year` — list all holidays for a given year
|
|
10
|
+
- `VerifiedHolidays.verify!` — verify built-in data against Cabinet Office CSV
|
|
11
|
+
- `VerifiedHolidays::Holiday` — holiday data class with `name_en`, `wday_name`
|
|
12
|
+
- holiday_jp drop-in compatibility via `require 'verified_holidays/holiday_jp_compat'`
|
|
13
|
+
- Weekly CI verification against Cabinet Office official data
|
|
14
|
+
- Holiday data from 1955 to 2027 (sourced from Cabinet Office CSV)
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kenta Ishizaki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# VerifiedHolidays
|
|
2
|
+
|
|
3
|
+
[](https://github.com/55728/verified_holidays/actions/workflows/test.yml)
|
|
4
|
+
[](https://github.com/55728/verified_holidays/actions/workflows/verify.yml)
|
|
5
|
+
[](https://badge.fury.io/rb/verified_holidays)
|
|
6
|
+
|
|
7
|
+
Japanese national holiday gem with **weekly verification against the Cabinet Office official data**.
|
|
8
|
+
|
|
9
|
+
If the verification badge is green, the holiday data is correct.
|
|
10
|
+
|
|
11
|
+
## Why "verified_holidays"?
|
|
12
|
+
|
|
13
|
+
Because the data is **verified**. Every week, GitHub Actions checks our built-in
|
|
14
|
+
holiday data against the Cabinet Office official CSV. If it matches, the badge
|
|
15
|
+
stays green.
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
gem "verified_holidays"
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ruby
|
|
26
|
+
require "verified_holidays"
|
|
27
|
+
|
|
28
|
+
# Check if a date is a holiday
|
|
29
|
+
VerifiedHolidays.holiday?(Date.new(2026, 1, 1)) # => true
|
|
30
|
+
VerifiedHolidays.holiday?(Date.new(2026, 3, 19)) # => false
|
|
31
|
+
|
|
32
|
+
# Date, DateTime, Time are all accepted
|
|
33
|
+
VerifiedHolidays.holiday?(Time.new(2026, 1, 1)) # => true
|
|
34
|
+
|
|
35
|
+
# Get holidays in a date range
|
|
36
|
+
holidays = VerifiedHolidays.between(Date.new(2026, 1, 1), Date.new(2026, 12, 31))
|
|
37
|
+
holidays.each do |h|
|
|
38
|
+
puts "#{h.date} #{h.name} (#{h.name_en})"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Get the holiday name
|
|
42
|
+
VerifiedHolidays.name(Date.new(2026, 1, 1)) # => "元日"
|
|
43
|
+
VerifiedHolidays.name(Date.new(2026, 3, 19)) # => nil
|
|
44
|
+
|
|
45
|
+
# Get all holidays for a year
|
|
46
|
+
VerifiedHolidays.year(2026)
|
|
47
|
+
# => [#<VerifiedHolidays::Holiday>, ...]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Holiday object
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
holiday = VerifiedHolidays.between(Date.new(2026, 1, 1), Date.new(2026, 1, 1)).first
|
|
54
|
+
holiday.date # => #<Date: 2026-01-01>
|
|
55
|
+
holiday.name # => "元日"
|
|
56
|
+
holiday.name_en # => "New Year's Day"
|
|
57
|
+
holiday.wday_name # => "Thursday"
|
|
58
|
+
holiday.week # => "Thursday" (alias for wday_name)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Migration from holiday_jp
|
|
62
|
+
|
|
63
|
+
Replace:
|
|
64
|
+
|
|
65
|
+
```ruby
|
|
66
|
+
require "holiday_jp"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
with:
|
|
70
|
+
|
|
71
|
+
```ruby
|
|
72
|
+
require "verified_holidays/holiday_jp_compat"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
That's it. `HolidayJp.holiday?`, `HolidayJp.between`, and `HolidayJp::Holiday` all work as before.
|
|
76
|
+
|
|
77
|
+
## Verification
|
|
78
|
+
|
|
79
|
+
This gem verifies its built-in data against the [Cabinet Office CSV](https://www8.cao.go.jp/chosei/shukujitsu/syukujitsu.csv) every week via GitHub Actions.
|
|
80
|
+
|
|
81
|
+
You can also run the verification yourself:
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
result = VerifiedHolidays.verify!
|
|
85
|
+
result.valid? # => true
|
|
86
|
+
result.missing # => entries in local data but not in Cabinet Office CSV
|
|
87
|
+
result.extra # => entries in Cabinet Office CSV but not in local data
|
|
88
|
+
result.mismatched # => entries with different names
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Or via Rake:
|
|
92
|
+
|
|
93
|
+
```sh
|
|
94
|
+
bundle exec rake verified_holidays:verify
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Data Source
|
|
98
|
+
|
|
99
|
+
Holiday data is sourced from the Cabinet Office of Japan (内閣府):
|
|
100
|
+
https://www8.cao.go.jp/chosei/shukujitsu/gaiyou.html
|
|
101
|
+
|
|
102
|
+
The data is provided under the terms of the [Government of Japan Standard Terms of Use](https://www.kantei.go.jp/jp/singi/it2/densi/kettei/gl2_betten_1.pdf) (CC BY compatible).
|
|
103
|
+
|
|
104
|
+
## Contributing
|
|
105
|
+
|
|
106
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/55728/verified_holidays.
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|