Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Fix convert date #220

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ import org.transmartproject.core.multidimquery.Dimension
import org.transmartproject.core.multidimquery.Hypercube
import org.transmartproject.core.multidimquery.HypercubeValue

import java.sql.Timestamp
import java.time.Instant
import java.time.ZoneId

/**
* <code>
Expand Down Expand Up @@ -164,6 +166,9 @@ class HypercubeJsonSerializer extends HypercubeSerializer {
writer.nullValue()
} else if (value instanceof String) {
writer.value((String) value)
} else if (value instanceof Timestamp) {
def time = ((Timestamp)value).toLocalDateTime().atZone(ZoneId.of("GMT")).toInstant().toString()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baroleg Thanks for contributing. Would it be possible for you to write a simple regression test that reproduces the issue?
See transmart-core/transmart-rest-api/src/test/groovy/org/transmartproject/rest/serialization/ for test examples.

writer.value(time)
} else if (value instanceof Date) {
def time = Instant.ofEpochMilli(((Date) value).time).toString()
writer.value(time)
Expand Down