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.
This commit is contained in:
Jonathan Flueren 2021-07-24 19:06:14 +02:00
parent df4bebf89e
commit 5a46233e46
1 changed files with 3 additions and 1 deletions

View File

@ -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");
}
}