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,8 @@ 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 (
352+ Instant .from (DateTimeFormatter .ISO_INSTANT .parse (date )).toEpochMilli ());
353353 } catch (ParseException e ) {
354354 throw new JsonParseException (e );
355355 }
@@ -383,7 +383,7 @@ public void write(JsonWriter out, Date date) throws IOException {
383383 if (dateFormat != null ) {
384384 value = dateFormat .format (date );
385385 } else {
386- value = ISO8601Utils . format (date , true );
386+ value = DateTimeFormatter . ISO_INSTANT . format (date . toInstant () );
387387 }
388388 out .value (value );
389389 }
@@ -402,7 +402,7 @@ public Date read(JsonReader in) throws IOException {
402402 if (dateFormat != null ) {
403403 return dateFormat .parse (date );
404404 }
405- return ISO8601Utils . parse (date , new ParsePosition ( 0 ));
405+ return Date . from ( Instant . from ( DateTimeFormatter . ISO_INSTANT . parse (date ) ));
406406 } catch (ParseException e ) {
407407 throw new JsonParseException (e );
408408 }
0 commit comments