diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java index 878b7af7d46..e6cae0c7ebc 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/CommentsMiniInfoItemHolder.java @@ -144,7 +144,8 @@ public void updateFromItem(final InfoItem infoItem, } if (item.getUploadDate() != null) { - itemPublishedTime.setText(Localization.relativeTime(item.getUploadDate().date())); + itemPublishedTime.setText(Localization.relativeTime(item.getUploadDate() + .offsetDateTime())); } else { itemPublishedTime.setText(item.getTextualUploadDate()); } diff --git a/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java b/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java index 86fad349945..3440fbe3c47 100644 --- a/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java +++ b/app/src/main/java/org/schabi/newpipe/info_list/holder/StreamInfoItemHolder.java @@ -95,7 +95,7 @@ private String getStreamInfoDetailLine(final StreamInfoItem infoItem) { private String getFormattedRelativeUploadDate(final StreamInfoItem infoItem) { if (infoItem.getUploadDate() != null) { String formattedRelativeTime = Localization - .relativeTime(infoItem.getUploadDate().date()); + .relativeTime(infoItem.getUploadDate().offsetDateTime()); if (DEBUG && PreferenceManager.getDefaultSharedPreferences(itemBuilder.getContext()) .getBoolean(itemBuilder.getContext() diff --git a/app/src/main/java/org/schabi/newpipe/util/Localization.java b/app/src/main/java/org/schabi/newpipe/util/Localization.java index 9cebfa8635b..afe2c04675b 100644 --- a/app/src/main/java/org/schabi/newpipe/util/Localization.java +++ b/app/src/main/java/org/schabi/newpipe/util/Localization.java @@ -30,6 +30,7 @@ import java.time.format.FormatStyle; import java.util.Arrays; import java.util.Calendar; +import java.util.GregorianCalendar; import java.util.List; import java.util.Locale; @@ -312,12 +313,12 @@ private static void initPrettyTime(final Context context) { prettyTime.removeUnit(Decade.class); } - private static PrettyTime getPrettyTime() { - return prettyTime; + public static String relativeTime(final OffsetDateTime offsetDateTime) { + return relativeTime(GregorianCalendar.from(offsetDateTime.toZonedDateTime())); } public static String relativeTime(final Calendar calendarTime) { - return getPrettyTime().formatUnrounded(calendarTime); + return prettyTime.formatUnrounded(calendarTime); } private static void changeAppLanguage(final Locale loc, final Resources res) {