I have a datasource with a custom fetch operationid:
Code:
<operationBinding operationType="fetch" operationId="info"> <serverMethod>fetchInfo</serverMethod> </operationBinding>
Code:
DSResponse resp = new DSResponse(); java.time.LocalTime local = java.time.LocalTime.of(10, 45); LocalTime joda = LocalTime.fromMillisOfDay(local.toSecondOfDay() * 1000); System.out.println("LocalTime: " + local); System.out.println("Joda LocalTime: " + joda); resp.setParameter("localtime", local); resp.setParameter("jodatime", joda); System.out.println("LocalTime: " + local); System.out.println("Joda LocalTime: " + joda);
LocalTime: 10:45
Joda LocalTime: 10:45:00.000
Joda LocalTime: 10:45:00.000
localtime: new Date(38700000)
jodatime: isc.DateUtil.parseServerTime(10,45,0,0)
jodatime: isc.DateUtil.parseServerTime(10,45,0,0)
Code:
GWT.log("local: " + resp.getAttribute("localtime")); GWT.log("joda: " + resp.getAttribute("jodatime")); GWT.log("local date: " + resp.getAttributeAsDate("localtime")); GWT.log("joda date: " + resp.getAttributeAsDate("jodatime"));
local: Thu Jan 01 1970 11:45:00 GMT+0100 (Central European Standard Time)
joda: Sun Dec 31 1899 10:45:00 GMT+0100 (Central European Standard Time)
local date: Thu Jan 01 11:45:00 GMT+100 1970
joda date: Sun Dec 31 10:45:00 GMT+100.23333333333333428
joda: Sun Dec 31 1899 10:45:00 GMT+0100 (Central European Standard Time)
local date: Thu Jan 01 11:45:00 GMT+100 1970
joda date: Sun Dec 31 10:45:00 GMT+100.23333333333333428
Isn't a bit strange that the two LocalTime objects, which both are Times without timezone information, are handled differently?
Leave a comment: