added more date formats

This commit is contained in:
Claudio Atzori 2021-05-27 17:28:34 +02:00
parent 6cce7245a3
commit 8e764c10fc
2 changed files with 8 additions and 7 deletions

View File

@ -7,21 +7,14 @@ import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.ParseException;
import java.time.Instant;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoField;
import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalField;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import eu.dnetlib.dhp.schema.oaf.*;
@ -314,6 +307,8 @@ public class ModelSupport {
public static final String[] DATE_TIME_FORMATS = {
"yyyy-MM-dd'T'hh:mm:ss.SSS'Z'",
"yyyy-MM-dd'T'hh:mm:ss'Z'",
"yyyy-MM-dd hh:mm:ss'Z'",
"yyyy-MM-dd hh:mm:ss"
};

View File

@ -97,6 +97,12 @@ public class MergeTest {
a.mergeFrom(b);
assertEquals("2020-09-10 11:08:52", a.getValidationDate());
a = createRel(true, "2021-03-16T10:32:42Z");
b = createRel(true, "2020-03-16T10:32:42Z");
a.mergeFrom(b);
assertEquals("2020-03-16T10:32:42Z", a.getValidationDate());
}
@Test