diff --git a/src/java/davmail/exchange/dav/DavExchangeSession.java b/src/java/davmail/exchange/dav/DavExchangeSession.java index 4942a567..c6c73f18 100644 --- a/src/java/davmail/exchange/dav/DavExchangeSession.java +++ b/src/java/davmail/exchange/dav/DavExchangeSession.java @@ -572,7 +572,7 @@ public class DavExchangeSession extends ExchangeSession { for (String attributeName : CONTACT_ATTRIBUTES) { String value = getPropertyIfExists(properties, attributeName); if (value != null) { - if ("bday".equals(attributeName) || "lastmodified".equals(attributeName)) { + if ("bday".equals(attributeName) || "lastmodified".equals(attributeName) || "datereceived".equals(attributeName)) { value = convertDate(value); } put(attributeName, value); diff --git a/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java b/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java index 0138fa5f..6991a9f7 100644 --- a/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java +++ b/src/test/davmail/exchange/TestExchangeSessionMessageFlags.java @@ -98,7 +98,7 @@ public class TestExchangeSessionMessageFlags extends AbstractExchangeSessionTest MimeMessage mimeMessage = createMimeMessage(); String messageName = UUID.randomUUID().toString(); HashMap properties = new HashMap(); - SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); + SimpleDateFormat dateFormatter = ExchangeSession.getExchangeZuluDateFormat(); dateFormatter.setTimeZone(ExchangeSession.GMT_TIMEZONE); Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, -1); @@ -108,7 +108,8 @@ public class TestExchangeSessionMessageFlags extends AbstractExchangeSessionTest assertNotNull(messageList); assertEquals(1, messageList.size()); assertNotNull(messageList); - assertEquals(properties.get("datereceived"), messageList.get(0).date); + // TODO: use same format for date read/write + assertEquals(ExchangeSession.getZuluDateFormat().format(cal.getTime()), messageList.get(0).date); }