mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-12-23 08:30:44 +00:00
Call DateWrapper's offsetDateTime() instead of date().
This commit is contained in:
parent
493e47f7e6
commit
eb1cddd85a
@ -144,7 +144,8 @@ public class CommentsMiniInfoItemHolder extends InfoItemHolder {
|
||||
}
|
||||
|
||||
if (item.getUploadDate() != null) {
|
||||
itemPublishedTime.setText(Localization.relativeTime(item.getUploadDate().date()));
|
||||
itemPublishedTime.setText(Localization.relativeTime(item.getUploadDate()
|
||||
.offsetDateTime()));
|
||||
} else {
|
||||
itemPublishedTime.setText(item.getTextualUploadDate());
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public class StreamInfoItemHolder extends StreamMiniInfoItemHolder {
|
||||
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()
|
||||
|
@ -30,6 +30,7 @@ import java.time.format.DateTimeFormatter;
|
||||
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 @@ public final class Localization {
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user