Closed teebu closed 11 months ago
Totally understand this, but trying to figure out what the issue is here.
What I think you're saying is that the format()
method for personnummer does not return the correct values for 4 digit year values. This would then apply to the compact version that is returned by the validate()
method as well.
Just checking before I break something
Does this look right, this is the test matrix I just built.
test.each([
['8803200017', '880320-0017'], // no hyphen assume young person
['880320-0017', '880320-0017'], // standard format
['880320+0017', '880320+0017'], // standard format, person over 100
['19200901-0000', '200901+0000'], // 4digit year, hypen that's useless person over 100
['192009010000', '200901+0000'], // 4digit year, no hyphen, person over 100
['20200901-0000', '200901-0000'], // 4digit year, hyphen
['202009010000', '200901-0000'], // 4digit year, no hyphen
])('format:%s', (given, want) => {
https://swedish.identityinfo.net/personalidentitynumber