koblas / stdnum-js

A JavaScript library to provide functions to handle, parse and validate standard numbers.
MIT License
38 stars 26 forks source link

Swdeden personalidentitynumber - format acceptance and age validations #113

Open teebu opened 7 months ago

teebu commented 7 months ago

https://swedish.identityinfo.net/personalidentitynumber

The format states the [-+] are optional.

teebu commented 7 months ago

I wonder if the - and + gets assigned only once during creation, and gets updated after a person turns 100 to make it accurate after they roll over 100 mark. I bet that doesn't happen often, most people don't live that long. 🤔

What happens to old records that were accurate at the time of entry with - but not today, as many years have passed and rolled them over 100 mark.

Probably explains why they are optional and use full year.

koblas commented 7 months ago

I've been working on this... It makes sense to "fix" the year to 4 digits and perform all validation after that. Not "stress" over the +- difference for the long form version.