Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions dspace-oai/src/main/java/org/dspace/xoai/util/DateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -34,12 +35,8 @@ private DateUtils() { }
* @return UTC date string
*/
public static String format(Instant date) {
// NOTE: OAI-PMH REQUIRES that all dates be expressed in UTC format
// as YYYY-MM-DDThh:mm:ssZ For more details, see
// http://www.openarchives.org/OAI/openarchivesprotocol.html#DatestampsResponses

// toString returns the correct format
return date.toString();
Instant truncated = date.truncatedTo(ChronoUnit.SECONDS);
return DateTimeFormatter.ISO_INSTANT.format(truncated);
}
Comment on lines 37 to 40

/**
Expand Down
1 change: 1 addition & 0 deletions dspace/config/crosswalks/oai/xoai.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<!-- Openaire filter -->
<Filter ref="openaire4Filter"/>
<!-- Metadata Formats -->
<Format ref="oaidc"/>
<Format ref="oaiopenaire"/>
<Description>
This contexts complies with Openaire Guidelines for Literature Repositories v4.0.
Expand Down
Loading