From 5a46233e46ad9f5be532b926f7130c78fc6c826a Mon Sep 17 00:00:00 2001 From: Jonathan Flueren Date: Sat, 24 Jul 2021 19:06:14 +0200 Subject: [PATCH] Update EpisodeActionController.php Use UTC timestamp for episode actions instead of the timezone used by the AntennaPod app. Correct conversion should be assured because the AntennaPod timestamp includes a timezone identifier (T). Also slightly change the output format for the DateTime-timestamp to equal other timestamp formats. --- lib/Controller/EpisodeActionController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Controller/EpisodeActionController.php b/lib/Controller/EpisodeActionController.php index e154815..d7fa3d5 100644 --- a/lib/Controller/EpisodeActionController.php +++ b/lib/Controller/EpisodeActionController.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace OCA\GPodderSync\Controller; use DateTime; +use DateTimeZone; use GuzzleHttp\Psr7\Response; use OCA\GPodderSync\Core\EpisodeAction\EpisodeActionReader; use OCA\GPodderSync\Db\EpisodeAction\EpisodeActionEntity; @@ -110,6 +111,7 @@ class EpisodeActionController extends Controller { private function convertTimestampToDbDateTimeString(string $timestamp) { return \DateTime::createFromFormat('D F d H:i:s T Y', $timestamp) - ->format("Y-m-d\TH:i:s"); + ->setTimezone(new DateTimeZone('UTC')) + ->format("Y-m-d H:i:s"); } }