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));