Fixed possible undefined date case

This commit is contained in:
Alexander Cerutti
2025-09-25 18:27:01 +02:00
parent 2e8278bc84
commit 16e61c0ad5

View File

@@ -1201,8 +1201,12 @@ function validateJSONBuffer(
function isRelevantEntry(
entry: Schemas.RelevantDate,
): entry is Schemas.RelevancyEntry {
return (
Object.prototype.hasOwnProperty.call(entry, "relevantDate") ||
Object.prototype.hasOwnProperty.call(entry, "date")
);
const isRelevantDateAvailable: boolean =
Object.prototype.hasOwnProperty.call(entry, "relevantDate") &&
"relevantDate" in entry;
const isDateAvailable: boolean =
Object.prototype.hasOwnProperty.call(entry, "date") && "date" in entry;
return isRelevantDateAvailable || isDateAvailable;
}