From 4c34f1f606a1f6c2c6edaf043889f0fc7242214a Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Mon, 3 Jun 2024 14:31:44 +0300 Subject: [PATCH] bug fix --- .../zenodorepository/model/builder/ZenodoBuilder.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java b/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java index c4eefdb..7b95c04 100644 --- a/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java +++ b/core/src/main/java/org/opencdmp/deposit/zenodorepository/model/builder/ZenodoBuilder.java @@ -80,8 +80,9 @@ public class ZenodoBuilder { org.opencdmp.commonmodels.models.dmpblueprint.FieldModel fieldOfSemantic = this.getFieldOfSemantic(dmp, SEMANTIC_PUBLICATION_DATE); if (fieldOfSemantic != null){ DmpBlueprintValueModel dmpBlueprintValueModel = this.getDmpBlueprintValue(dmp, fieldOfSemantic.getId()); - - if (dmpBlueprintValueModel != null && dmpBlueprintValueModel.getValue() != null && !dmpBlueprintValueModel.getValue().isBlank()){ + if (dmpBlueprintValueModel != null && dmpBlueprintValueModel.getDateValue() != null) { + deposit.getMetadata().setPublicationDate(DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(dmpBlueprintValueModel.getDateValue())); + } else if (dmpBlueprintValueModel != null && dmpBlueprintValueModel.getValue() != null && !dmpBlueprintValueModel.getValue().isBlank()){ try { Instant instant = Instant.parse(dmpBlueprintValueModel.getValue()); deposit.getMetadata().setPublicationDate(DateTimeFormatter.ofPattern("yyyy-MM-dd").withZone(ZoneId.systemDefault()).format(instant));