LocalDataTime handling bug (possible)
RichardHightower opened this issue · 0 comments
RichardHightower commented
From a user...
Converted entire project over from Joda to Java 8 Datetime
Probably I should have check this first but
when I parse the dates with Boon they come out wrong
The json says this
" ],\n" +
" \"startTime\": \"2016-06-21T21:10:45.3271564Z\",\n" +
" \"endTime\": \"2016-06-21T21:11:42.5356272Z\",\n" +
2016-06-21T21:10:45.3271564Z
2016-06-21T21:11:42.5356272Z
you can see they are about a minute off
after parsing into Query object
they are this
2016-06-22T06:16:00.682
2016-06-22T12:04:24.762
magically 6 hours different!
public class BoonDateParseBugTest {
class DateFecker {
public LocalDateTime startTime;
public LocalDateTime endTime;
}
@Test
public void testDateParseIsBogus() {
final JsonMapper jsonMapper = QBit.factory().createJsonMapper();
Map<String, String> data = new HashMap<>();
data.put("startTime", "2016-06-21T21:10:45.3271564Z");
data.put("endTime", "2016-06-21T21:11:42.5356272Z");
String dataString = jsonMapper.toJson(data);
final DateFecker query = jsonMapper.fromJson(dataString, DateFecker.class);
assertEquals(21, query.startTime.getHour());
assertEquals(21, query.endTime.getHour());
}
}
There's a test that demonstrates