diff --git a/src/components/fields/CustomDataTypeUBHDGND.svelte b/src/components/fields/CustomDataTypeUBHDGND.svelte index 42750e8..f507085 100644 --- a/src/components/fields/CustomDataTypeUBHDGND.svelte +++ b/src/components/fields/CustomDataTypeUBHDGND.svelte @@ -7,9 +7,26 @@ export let field; const fdata = fieldData(data, table, field); + + function extractYear(date) { + if (date) { + return date.split("-")[0]; + } + return ""; + } + + function detailString(details) { + if (details.dateOfDeath) { + if (details.dateOfBirth) { + return ` (${extractYear(details.dateOfBirth)} - ${extractYear(details.dateOfDeath)})`; + } + return ` (? - ${extractYear(details.dateOfDeath)})`; + } + return ""; + } - {fdata.conceptName} + {fdata.conceptName}{detailString(fdata.conceptDetails)} GND