Skip to content

Commit 6eafa09

Browse files
committed
chore: improve coverage
1 parent b145c37 commit 6eafa09

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

src/lib/isDate.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ function extractDatePartsWithoutDelimiter(input, format) {
6363
const dateObj = {};
6464

6565
for (const comp of components) {
66-
const value = input.substring(comp.start, comp.start + comp.length);
67-
if (value.length !== comp.length) {
68-
return null; // Input too short
69-
}
70-
dateObj[comp.type] = value;
66+
dateObj[comp.type] = input.substring(
67+
comp.start,
68+
comp.start + comp.length
69+
);
7170
}
7271

7372
return dateObj;
@@ -105,9 +104,6 @@ export default function isDate(input, options) {
105104
return false;
106105
}
107106
dateObj = extractDatePartsWithoutDelimiter(input, options.format);
108-
if (!dateObj) {
109-
return false;
110-
}
111107
} else {
112108
// Original delimiter-based parsing
113109
const formatDelimiter = options.delimiters

0 commit comments

Comments
 (0)