1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-17 02:44:04 +02:00

Hotfix for connection issues on API < 24

Fix #1055 properly, as the previous change was not solving the issues
on API < 24. This affected the connection to some devices and caused a
crash on graph access.
This commit is contained in:
Daniele Gobbetti 2018-04-16 18:26:23 +02:00
parent f88ef0e688
commit c71eba9483

View File

@ -33,15 +33,15 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
public class DateTimeUtils {
private static SimpleDateFormat DAY_STORAGE_FORMAT = new SimpleDateFormat("yyyy-MM-dd", Locale.US);
public static SimpleDateFormat ISO_8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US);
public static SimpleDateFormat ISO_8601_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZZZ", Locale.US);
public static String formatDateTime(Date date) {
return DateUtils.formatDateTime(GBApplication.getContext(), date.getTime(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_NO_YEAR);
}
public static String formatIso8601(Date date) {
if(!GBApplication.isRunningNougatOrLater()){
return new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ssZZZ", Locale.US).format(date);
if(GBApplication.isRunningNougatOrLater()){
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.US).format(date);
}
return ISO_8601_FORMAT.format(date);
}