Kennitala
Kennitala copied to clipboard
Invalid date is accepted as valid kennitala
The isPerson validation does not account for invalid dates. I see the current code simply checks that the day is <= 31, but 310222 for instance is not a valid date, and hence not a valid kennitala.
Would have to parse the date and validate it.
One way to do it:
const isValid = isNaN(new Date('2022-02-31').getTime())
Related to #16
Interesting. Not a bad idea to validate the months.
This has been implemented on the v2 branch, you can try yarn add [email protected] to test it out.