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

Fix convert date #220

wants to merge 2 commits into from

Conversation

baroleg
Copy link

@baroleg baroleg commented Apr 24, 2018

Rest request

/v2/observations?constraint={"type":"concept","path":""}&type=clinical

return "startDate": "0000-12-30T00:00:00Z", but in db value is 0001-01-01 00:00:00 (Default value).
Convert as
def time = Instant.ofEpochMilli(((Date) value).time).toString()
is worked for normal date, but for very old date Instant is more strong and convert works wrong.

@gijskant gijskant requested a review from forus April 30, 2018 09:22
@@ -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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants