We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 696e63b commit 7c7efb8Copy full SHA for 7c7efb8
src/validation.ts
@@ -256,8 +256,12 @@ function createNumberValidator(): NumberValidator {
256
test: (val: number) => {
257
if (val === undefined || val === null)
258
return true
259
- const timestampStr = String(val)
260
- return timestampStr.length >= 10 && timestampStr.length <= 13
+ // Check if it's an integer
+ 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
265
},
266
message: config.errorMessages?.timestamp || 'Must be a valid JavaScript timestamp (10-13 digits)',
267
}
0 commit comments