Skip to content

Commit 6702720

Browse files
committed
build fixes
1 parent 90d4eac commit 6702720

File tree

1 file changed

+3
-2
lines changed
  • packages/validation/src

1 file changed

+3
-2
lines changed

packages/validation/src/se.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ export function validateNationalIdentityNumber(
153153
const date = new Date();
154154
const baseYear =
155155
separator === '+' ? date.getUTCFullYear() - 100 : date.getUTCFullYear();
156-
year = baseYear - ((baseYear - yearStr) % 100);
156+
year =
157+
baseYear - ((baseYear - Number.parseInt(yearStr as string, 10)) % 100);
157158
break;
158159
}
159160
// if it's the short format, without a separator, we need to special handle the year for the date validation.
@@ -176,7 +177,7 @@ export function validateNationalIdentityNumber(
176177
day = day - 60;
177178
}
178179

179-
return isValidDate(year, month, day, centuryStr || separator);
180+
return isValidDate(year, month, day, Boolean(centuryStr || separator));
180181
}
181182

182183
// just reexport the no method for API feature parity

0 commit comments

Comments
 (0)