Fixed date parsing issue
This commit is contained in:
parent
01d6924dc4
commit
94675ed655
@ -29,10 +29,11 @@ export function handleDates(body: any) {
|
|||||||
|
|
||||||
for (const key of Object.keys(body)) {
|
for (const key of Object.keys(body)) {
|
||||||
const value = body[key];
|
const value = body[key];
|
||||||
if (value !== undefined && value !== "" && isNaN(value)) {
|
if (typeof value === "string" && value !== "" && isNaN(value as any)) {
|
||||||
const parsedValue: Date = parseISO(value);
|
const parsedValue: Date = parseISO(value);
|
||||||
if (isValid(parsedValue)) body[key] = parsedValue;
|
if (isValid(parsedValue)) body[key] = parsedValue;
|
||||||
else if (typeof value === "object") handleDates(value);
|
} else if (typeof value === "object" && value !== null) {
|
||||||
|
handleDates(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user