1717import com .google .gson .JsonElement ;
1818import com .google .gson .JsonParseException ;
1919import com .google .gson .TypeAdapter ;
20- import com .google .gson .internal .bind .util .ISO8601Utils ;
2120import com .google .gson .stream .JsonReader ;
2221import com .google .gson .stream .JsonWriter ;
2322import io .gsonfire .GsonFireBuilder ;
2827import java .lang .reflect .Type ;
2928import java .text .DateFormat ;
3029import java .text .ParseException ;
31- import java .text . ParsePosition ;
30+ import java .time . Instant ;
3231import java .time .LocalDate ;
3332import java .time .OffsetDateTime ;
3433import java .time .format .DateTimeFormatter ;
@@ -349,7 +348,7 @@ public java.sql.Date read(JsonReader in) throws IOException {
349348 if (dateFormat != null ) {
350349 return new java .sql .Date (dateFormat .parse (date ).getTime ());
351350 }
352- return new java .sql .Date (ISO8601Utils . parse (date , new ParsePosition ( 0 )).getTime ());
351+ return new java .sql .Date (Instant . from ( DateTimeFormatter . ISO_INSTANT . parse (date )).toEpochMilli ());
353352 } catch (ParseException e ) {
354353 throw new JsonParseException (e );
355354 }
@@ -383,7 +382,7 @@ public void write(JsonWriter out, Date date) throws IOException {
383382 if (dateFormat != null ) {
384383 value = dateFormat .format (date );
385384 } else {
386- value = ISO8601Utils . format (date , true );
385+ value = DateTimeFormatter . ISO_INSTANT . format (date . toInstant () );
387386 }
388387 out .value (value );
389388 }
@@ -402,7 +401,7 @@ public Date read(JsonReader in) throws IOException {
402401 if (dateFormat != null ) {
403402 return dateFormat .parse (date );
404403 }
405- return ISO8601Utils . parse (date , new ParsePosition ( 0 ));
404+ return Date . from ( Instant . from ( DateTimeFormatter . ISO_INSTANT . parse (date ) ));
406405 } catch (ParseException e ) {
407406 throw new JsonParseException (e );
408407 }
0 commit comments