Skip to content

Commit

Permalink
Test date fields before rendering on pub page (#872)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalilsn authored Dec 24, 2024
1 parent 8951352 commit dab57f0
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ const PubValue = ({ value }: { value: FullProcessedPub["values"][number] }) => {
}

if (value.schemaName === CoreSchemaType.DateTime) {
return new Date(value.value as string).toISOString().split("T")[0];
const date = new Date(value.value as string);
if (date.toString() !== "Invalid Date") {
return date.toISOString().split("T")[0];
}
}

const valueAsString = (value.value as JsonValue)?.toString() || "";
Expand Down

0 comments on commit dab57f0

Please sign in to comment.