From 8b2106229a2f12beee0ad62966d48dd83125d100 Mon Sep 17 00:00:00 2001 From: Dominic Kempf Date: Thu, 25 Jul 2024 13:38:38 +0200 Subject: [PATCH] Detail information for UBHD GND Plugin --- .../fields/CustomDataTypeUBHDGND.svelte | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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