Skip to content

ZonedDateTime for times before the epoch do not serialize correctly  #69

Description

@cowtowncoder

(moved from https://github.com/FasterXML/jackson-datatype-jsr310/issues/97
reported by @twilson-palantir )

Version 2.8.10

    public static void main(String[] args) throws Exception {
        ObjectMapper mapper = new ObjectMapper().registerModule(new JavaTimeModule());
        ZonedDateTime original = ZonedDateTime.parse("1959-04-13T05:05:38.599Z");
        String serialized = mapper.writeValueAsString(original);
        ZonedDateTime deserialized = mapper.readValue(serialized, ZonedDateTime.class);
        System.out.println(original);
        System.out.println(serialized);
        System.out.println(deserialized);
    }

outputs

1959-04-13T05:05:38.599Z
-338324062.599000000
1959-04-13T05:05:37.401Z[UTC]

I haven't checked other types for issues, but I wouldn't be surprised if they were similarly broken.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions