Open Herdismaria opened 1 week ago
Also should the Date parameter be optional for generatePerson
? it looks like it's required now :)
Thanks for the bug report @Herdismaria
I think the tests might be failing because like the KT you generated shows it has a 7th-8th digits of 01
which would be illegal for persons since they start generating personal ID's at 20
and up.
Looks like the bug is residing in ./src/generation.ts
where startingIncrement
should have a default value of 20
.
I'll push out a fix for after work today. Apologies for the inconvenience. If you want a quick fix you can add 20
as an optional parameter to your generatePerson
function call.
const generatePerson = (
date: Date,
startingIncrement?: number
): string | undefined => {
return generateKennitala(date, personDayDelta, startingIncrement);
};
Also should the Date parameter be optional for
generatePerson
? it looks like it's required now :)
Interesting thought. So if the Date parameter is optional we could generate a random Date as a default parameter?
Would be a cool feature
According to the docs the date parameter should be optional, just thought it might have changed with the new version 🤷♀️
Docs:
Function
export function generatePerson(date: Date): string;
It looks like either the
generatePerson
function orinfo
has some bug in it. If I usegeneratePerson
to create a kennitala and then useinfo
to parse it,info
sometimes results in invalid kennitala.Example of a kennitala created with generatePerson
This test is flaky. I'm using version 2.0.6.