Skip to content

Commit 97a8342

Browse files
committed
Making date serialize to UTC format
1 parent ad17574 commit 97a8342

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
<artifactId>slf4j-api</artifactId>
3535
<version>1.7.30</version>
3636
</dependency>
37+
<dependency>
38+
<groupId>com.fasterxml.jackson.datatype</groupId>
39+
<artifactId>jackson-datatype-jsr310</artifactId>
40+
<version>2.10.0</version>
41+
</dependency>
3742
<!--Test Dependencies-->
3843
<dependency>
3944
<groupId>org.junit.jupiter</groupId>

src/main/java/com/exceptionless/exceptionlessclient/utils/Utils.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package com.exceptionless.exceptionlessclient.utils;
22

33
import com.fasterxml.jackson.databind.ObjectMapper;
4+
import com.fasterxml.jackson.databind.SerializationFeature;
5+
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
46
import org.slf4j.Logger;
57
import org.slf4j.LoggerFactory;
68

@@ -9,7 +11,12 @@
911
import java.util.*;
1012

1113
public final class Utils {
12-
public static final ObjectMapper JSON_MAPPER = new ObjectMapper();
14+
public static final ObjectMapper JSON_MAPPER;
15+
static {
16+
JSON_MAPPER = new ObjectMapper();
17+
JSON_MAPPER.registerModule(new JavaTimeModule());
18+
JSON_MAPPER.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
19+
}
1320

1421
private static final Logger LOG = LoggerFactory.getLogger(Utils.class);
1522

0 commit comments

Comments
 (0)