Skip to content

Commit

Permalink
Support vin decode years 2005-2034 (#13)
Browse files Browse the repository at this point in the history
* support vin decode years 2005-2034

* fix test
  • Loading branch information
JamesReate committed Dec 13, 2022
1 parent e73aa7f commit d94bcd3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
22 changes: 11 additions & 11 deletions vin_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ package shared
// In the year digit we additionally disallow U, Z, and 0.
// https://en.wikibooks.org/wiki/Vehicle_Identification_Numbers_(VIN_codes)/Model_year
var years = map[byte]int{
'R': 1994,
'S': 1995,
'T': 1996,
'V': 1997,
'W': 1998,
'X': 1999,
'Y': 2000,
'1': 2001,
'2': 2002,
'3': 2003,
'4': 2004,
'5': 2005,
'6': 2006,
'7': 2007,
Expand All @@ -34,6 +23,17 @@ var years = map[byte]int{
'M': 2021,
'N': 2022,
'P': 2023,
'R': 2024,
'S': 2025,
'T': 2026,
'V': 2027,
'W': 2028,
'X': 2029,
'Y': 2030,
'1': 2031,
'2': 2032,
'3': 2033,
'4': 2034,
}

type VIN string
Expand Down
5 changes: 0 additions & 5 deletions vin_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ func TestVIN_Year(t *testing.T) {
v: "2FMPK4J97NBA08224",
want: 2022,
},
{
name: "2004 VIN",
v: "WBAEW53494PG11352",
want: 2004,
},
}

for _, tt := range tests {
Expand Down

0 comments on commit d94bcd3

Please sign in to comment.