From 4325893e4c8fe5ee7a49dbae8ce3ec74578d370a Mon Sep 17 00:00:00 2001 From: David Straub Date: Sun, 14 Jan 2024 12:42:07 +0100 Subject: [PATCH] Age color: exclude ranges, estimated dates etc. (#352) --- src/charts/FanChart.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/charts/FanChart.js b/src/charts/FanChart.js index 409103c5..e6311b42 100644 --- a/src/charts/FanChart.js +++ b/src/charts/FanChart.js @@ -43,12 +43,17 @@ const colorFunctions = { age: { type: 'number', fct: person => { - const dBirth = - person?.extended?.events?.[person?.birth_ref_index]?.date?.sortval || - undefined - const dDeath = - person?.extended?.events?.[person?.death_ref_index]?.date?.sortval || - undefined + let dBirth = person?.extended?.events?.[person?.birth_ref_index]?.date + dBirth = + // only normal dates, no spans etc., quality not estimated + dBirth !== undefined && dBirth.modifier === 0 && dBirth.quality !== 1 + ? dBirth.sortval || undefined + : undefined + let dDeath = person?.extended?.events?.[person?.death_ref_index]?.date + dDeath = + dDeath !== undefined && dDeath.modifier === 0 && dDeath.quality !== 1 + ? dDeath.sortval || undefined + : undefined if (dBirth === undefined || dDeath === undefined) { return undefined }