Skip to content

Commit

Permalink
Age color: exclude ranges, estimated dates etc. (#352)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidMStraub committed Jan 14, 2024
1 parent abd1083 commit 4325893
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/charts/FanChart.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 4325893

Please sign in to comment.