verified_holidays 0.3.5 → 0.3.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 498675ea5314d9975675259c063fd799ed6ccd6ae26b8e9ee580820f66f762ed
4
- data.tar.gz: 0b9f867b89a650bb61094af00b416e1aa619598ab496823c510660de2b7a61e3
3
+ metadata.gz: 8f7bf742f61c56edc7ef80cbb753650bdcb44965383a0ac25b3f1651c78e8ca8
4
+ data.tar.gz: 891551f9c64d0b3fd747797b3d765ec6b84a2372f27209019bd4d15532d73dce
5
5
  SHA512:
6
- metadata.gz: 761f2bbf074908bb02bd0e465749a11d2e5ad92600e0a48c618e91d9003368f26966d7cd5d52353ed481daa73c562f9f455b18b26c544d4b23b55e8be853ebc0
7
- data.tar.gz: 4c2fff184eced49b5472f6dde573c8421b7be8659f13171bdc0fe48b1ecd2e8a8d8d5695ac046c3c7da522fd1ab0676729532270bf9066c0e6ac2d627507c1a6
6
+ metadata.gz: e26b65493fa53d72c5b6d2d518412155c0b71611e43008bdc0ccb5942f5bf792c9065b110b88b83caf3f6974e94d497bb6974f60d3bfeafbd7b155998aadacbe
7
+ data.tar.gz: 216450240d0eb5aaca627a55ee654321e20a935911817c5e103115ec3bdcc73eccca850c17794c05726723d9880eab1c2838c5eabe3711f82327a4763a29fd3f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.7](https://github.com/verified-holidays/verified_holidays/compare/verified_holidays/v0.3.6...verified_holidays/v0.3.7) (2026-08-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * raise FetchError when the Cabinet Office CSV holds an invalid date ([#45](https://github.com/verified-holidays/verified_holidays/issues/45)) ([3bde219](https://github.com/verified-holidays/verified_holidays/commit/3bde219754ea301a26605f7b9de50a8244cfd636))
9
+
10
+ ## [0.3.6](https://github.com/verified-holidays/verified_holidays/compare/verified_holidays/v0.3.5...verified_holidays/v0.3.6) (2026-08-23)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * complete the holiday_jp drop-in compatibility ([#43](https://github.com/verified-holidays/verified_holidays/issues/43)) ([a09a5ee](https://github.com/verified-holidays/verified_holidays/commit/a09a5eeb14e526571e8252b321ecb9c1a1e20ae1))
16
+
3
17
  ## [0.3.5](https://github.com/verified-holidays/verified_holidays/compare/verified_holidays/v0.3.4...verified_holidays/v0.3.5) (2026-08-23)
4
18
 
5
19
 
data/README.md CHANGED
@@ -32,7 +32,7 @@ require "verified_holidays"
32
32
  VerifiedHolidays.holiday?(Date.new(2026, 1, 1)) # => true
33
33
  VerifiedHolidays.holiday?(Date.new(2026, 3, 19)) # => false
34
34
 
35
- # Date, DateTime, Time are all accepted
35
+ # Date, DateTime, Time (or anything responding to #to_date) are all accepted
36
36
  VerifiedHolidays.holiday?(Time.new(2026, 1, 1)) # => true
37
37
 
38
38
  # Get holidays in a date range
@@ -102,7 +102,7 @@ result.mismatched # => entries with different names
102
102
 
103
103
  If the Cabinet Office responds with anything other than success — an outage, a
104
104
  moved file, a redirect — or answers with something that holds no holidays at
105
- all, `verify!` raises `VerifiedHolidays::CabinetOffice::FetchError` rather than
105
+ all or contains a date it cannot parse, `verify!` raises `VerifiedHolidays::CabinetOffice::FetchError` rather than
106
106
  reporting the data as mismatched.
107
107
 
108
108
  Or via Rake:
@@ -49,6 +49,8 @@ module VerifiedHolidays
49
49
  holidays[Date.strptime(date_str, '%Y/%m/%d')] = name
50
50
  end
51
51
  holidays
52
+ rescue Date::Error => e
53
+ raise FetchError, "#{CSV_URL} contains an invalid date: #{e.message}"
52
54
  end
53
55
  end
54
56
  end
@@ -15,6 +15,7 @@ module VerifiedHolidays
15
15
  def all
16
16
  @holidays
17
17
  end
18
+ alias holidays all
18
19
 
19
20
  def between(start_date, last_date)
20
21
  start_date = to_date(start_date)
@@ -44,6 +45,8 @@ module VerifiedHolidays
44
45
  # DateTime is a subclass of Date, so convert it explicitly with .to_date.
45
46
  return value.to_date if value.is_a?(DateTime) || value.is_a?(Time)
46
47
  return value if value.is_a?(Date)
48
+ # Anything else that knows how to become a Date (holiday_jp accepts these too).
49
+ return value.to_date if value.respond_to?(:to_date)
47
50
 
48
51
  raise ArgumentError, "expected Date, DateTime, or Time, got #{value.class}"
49
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VerifiedHolidays
4
- VERSION = '0.3.5'
4
+ VERSION = '0.3.7'
5
5
  end
@@ -23,6 +23,11 @@ module VerifiedHolidays
23
23
  Dataset.instance.year(year)
24
24
  end
25
25
 
26
+ # holiday_jp compatibility: HolidayJp.holidays returns the collection object.
27
+ def self.holidays
28
+ Dataset.instance
29
+ end
30
+
26
31
  def self.verify!
27
32
  Verifier.verify!
28
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: verified_holidays
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kenta Ishizaki