File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
src/test/java/com/fasterxml/jackson/databind/ser Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,15 @@ static class DateInCETBean {
37
37
public Date date ;
38
38
public DateInCETBean (long l ) { date = new java .util .Date (l ); }
39
39
}
40
+
41
+ static class CalendarAsStringBean {
42
+ @ JsonFormat (shape =JsonFormat .Shape .STRING , pattern ="yyyy-MM-dd" )
43
+ public Calendar value ;
44
+ public CalendarAsStringBean (long l ) {
45
+ value = new GregorianCalendar ();
46
+ value .setTimeInMillis (l );
47
+ }
48
+ }
40
49
41
50
/*
42
51
/**********************************************************
@@ -146,6 +155,10 @@ public void testDateWithJsonFormat() throws Exception
146
155
// and with different DateFormat; CET is one hour ahead of GMT
147
156
json = mapper .writeValueAsString (new DateInCETBean (0L ));
148
157
assertEquals ("{\" date\" :\" 1970-01-01,01:00\" }" , json );
158
+
159
+ // and for [Issue#423] as well:
160
+ json = mapper .writer ().with (getUTCTimeZone ()).writeValueAsString (new CalendarAsStringBean (0L ));
161
+ assertEquals ("{\" date\" :\" 1970-01-01\" }" , json );
149
162
}
150
163
151
164
/**
You can’t perform that action at this time.
0 commit comments