Not Support DataTime with Zone
kangpengjie opened this issue · comments
kangpengjie commented
@test
public void testJodaDateZoneUsingGson() throws Exception{
Gson gson = Converters.registerDateTime(new GsonBuilder()).create();
DateTime now = new DateTime(2016,8,29,15,10,30);
DateTimeZone dtz = DateTimeZone.forID("Europe/Berlin");
DateTime now1 = now.withZone(dtz);
System.out.println(now1 + "," + now1.getZone());
String nowStr1 = gson.toJson(now1);
DateTime convertedNow1 = gson.fromJson(nowStr1, DateTime.class);
assertEquals("Europe/Berlin", convertedNow1.getZone().toString());
}
The convertedNow1.getZone() return is Local Zone.