Skip to content

Commit 7c7efb8

Browse files
chore: wip
1 parent 696e63b commit 7c7efb8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/validation.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,12 @@ function createNumberValidator(): NumberValidator {
256256
test: (val: number) => {
257257
if (val === undefined || val === null)
258258
return true
259-
const timestampStr = String(val)
260-
return timestampStr.length >= 10 && timestampStr.length <= 13
259+
// Check if it's an integer
260+
if (!Number.isInteger(val))
261+
return false
262+
// Count digits using Math.log10
263+
const digits = Math.floor(Math.log10(Math.abs(val))) + 1
264+
return digits >= 10 && digits <= 13
261265
},
262266
message: config.errorMessages?.timestamp || 'Must be a valid JavaScript timestamp (10-13 digits)',
263267
}

0 commit comments

Comments
 (0)