Skip to content

Commit 5756df8

Browse files
committed
Use GMT as base time (actually fix upload date)
1 parent b671a4b commit 5756df8

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/PeertubeParsingHelper.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import java.text.SimpleDateFormat;
55
import java.util.Calendar;
66
import java.util.Date;
7-
import java.util.concurrent.TimeUnit;
7+
import java.util.TimeZone;
88

99
import org.jsoup.helper.StringUtil;
1010
import org.schabi.newpipe.extractor.exceptions.ContentNotAvailableException;
@@ -13,22 +13,23 @@
1313
import com.grack.nanojson.JsonObject;
1414

1515
public class PeertubeParsingHelper {
16-
16+
1717
private PeertubeParsingHelper() {
1818
}
1919

2020
public static void validate(JsonObject json) throws ContentNotAvailableException {
2121
String error = json.getString("error");
22-
if(!StringUtil.isBlank(error)) {
22+
if (!StringUtil.isBlank(error)) {
2323
throw new ContentNotAvailableException(error);
2424
}
2525
}
26-
26+
2727
public static Calendar parseDateFrom(String textualUploadDate) throws ParsingException {
2828
Date date;
2929
try {
30-
date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'").parse(textualUploadDate);
31-
date = new Date(date.getTime() + TimeUnit.HOURS.toMillis(1));
30+
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.S'Z'");
31+
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
32+
date = sdf.parse(textualUploadDate);
3233
} catch (ParseException e) {
3334
throw new ParsingException("Could not parse date: \"" + textualUploadDate + "\"", e);
3435
}

0 commit comments

Comments
 (0)