File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
MobileBuy/buy3/src/main/java/com/shopify/buy3 Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 26
26
27
27
import java .text .ParseException ;
28
28
import java .text .SimpleDateFormat ;
29
+ import java .time .Instant ;
29
30
import java .util .Date ;
30
31
import java .util .Locale ;
31
32
32
33
final class Utils {
33
34
private static final SimpleDateFormat DATE_TIME_FORMATTER = new SimpleDateFormat ("yyyy-MM-dd'T'HH:mm:ssZ" , Locale .US );
34
35
35
36
static Date parseDateTime (String dateTime ) {
36
- try {
37
+ try {
38
+ Instant instant = Instant .parse (dateTime );
39
+ return Date .from (instant );
40
+ } catch (Exception e1 ) {
41
+ // Fallback to legacy parsing in case of exception
42
+ try {
37
43
return DATE_TIME_FORMATTER .parse (dateTime );
38
- } catch (ParseException e ) {
44
+ } catch (ParseException e2 ) {
39
45
return new Date ();
40
- }
46
+ }
47
+ }
41
48
}
42
49
43
50
private Utils () {
You can’t perform that action at this time.
0 commit comments