Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## [Unreleased]

Fixes:
- Fix Bulgaria to accept TINs starting with `10` instead of `00` 🇧🇬
- Fix Finland checks for tins ending in `P` 🇫🇮
- Fix Denmark check for certain ranges of birth years 🇩🇰

Expand Down
10 changes: 9 additions & 1 deletion lib/tin_valid/bulgaria_tin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ def valid?
}x
private_constant :MATCHER

def accepted_date?(year, month, day)
if year == "10"
valid_date?(year, month, day) || valid_date?("00", month, day)
else
valid_date?(year, month, day)
end
end

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/MethodLength
def accepted_date?(year, month, day)
def valid_date?(year, month, day)
month = month.to_i
day = day.to_i

Expand Down
1 change: 1 addition & 0 deletions spec/tin_valid/bulgaria_tin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
describe "#valid?" do
valid_values = [
["7501010010", nil],
["1042054007", Date.new(2000, 2, 5)],
["7501010010", Date.new(1975, 1, 1)],
]

Expand Down