Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/unreleased/4783
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ This new section shows information like public link names, types and expiration

https://github.com/owncloud/android/issues/4752
https://github.com/owncloud/android/pull/4783
https://github.com/owncloud/android/pull/4834
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class DisplayUtils {
private static final int[] sizeScales = {0, 0, 1, 1, 1, 2, 2, 2, 2};

private static final String DATE_FORMAT_DISPLAY = "dd/MM/yyyy HH:mm";
private static final String DATE_FORMAT_ISO_WITHOUT_MILLISECONDS = "yyyy-MM-dd'T'HH:mm:ss'Z'";
public static final String DATE_FORMAT_ISO = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";

private static Map<String, String> mimeType2HumanReadable;
Expand Down Expand Up @@ -290,8 +291,12 @@ public static Pair<String, String> formatFromBytes(long bytes) {
public static String displayDateToHumanReadable(String date) throws ParseException {
SimpleDateFormat parser = new SimpleDateFormat(DATE_FORMAT_ISO, Locale.ROOT);
parser.setTimeZone(TimeZone.getTimeZone("UTC"));
Date dateParsed = parser.parse(date);
SimpleDateFormat formatter = new SimpleDateFormat(DATE_FORMAT_DISPLAY, Locale.ROOT);
return formatter.format(dateParsed);
try {
return formatter.format(parser.parse(date));
} catch (ParseException e) {
parser.applyPattern(DATE_FORMAT_ISO_WITHOUT_MILLISECONDS);
return formatter.format(parser.parse(date));
}
}
}
Loading