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
Expand Up @@ -2,6 +2,7 @@

Fixes:
- Fix Belgium to ignore `-` and `.` 🇧🇪
- Fix Czechia to accept `CZ` prefix 🇨🇿

## [1.3.0] - 2025-12-12

Expand Down
10 changes: 6 additions & 4 deletions lib/tin_valid/czechia_tin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def valid? = valid_v1? || valid_v2?
}x
private_constant :MATCHER_V2

def normalized = @normalized ||= tin&.delete_prefix("CZ")

def valid_v1?
match = MATCHER_V1.match(tin)
match = MATCHER_V1.match(normalized)
return false unless match
return false if tin == "000000000"
return false if normalized == "000000000"
return true if birth_date.nil?
return false if year_of_birth >= 1954

Expand All @@ -55,9 +57,9 @@ def valid_v1?
end

def valid_v2?
match = MATCHER_V2.match(tin)
match = MATCHER_V2.match(normalized)
return false unless match
return false if tin == "0000000000"
return false if normalized == "0000000000"
return true if birth_date.nil?
return false if year_of_birth < 1954

Expand Down
1 change: 1 addition & 0 deletions spec/tin_valid/czechia_tin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
describe "#valid?" do
valid_values = [
["420901999", nil],
["CZ420901999", nil],
["420901/999", nil],
["0009019999", nil],
["000901/9999", nil],
Expand Down