Open pbek opened 1 year ago
Timezone looks correct in mariadb too...
No, the timezone in the DB is not correct, the MySQL dump showed me '2023-06-06 06:15:30'
, no TZ, so it's stored without TZ (= UTC).
When I create an entry in the Web UI with 20:00 it's stored correctly as '2023-06-06 18:00:00'
in the DB. So Deck seems to store DateTimes without converting it first to UTC via the public API.
I found https://github.com/nextcloud/deck/blob/8038e568a3a8ecec29fa8747a2981426d62f3b3d/lib/Service/CardService.php#L238, but I guess at that time there are still strings...
Maybe dealing with it in https://github.com/nextcloud/deck/blob/8038e568a3a8ecec29fa8747a2981426d62f3b3d/lib/Db/CardMapper.php#L77, but I'm fishing in the dark, since Nextcloud seems to handle those conversion.
Hi,
I stumbled on this issue, while looking for a solution for a different one. I think the problem here is that $duedate
is passed directly when creating a new card. This is bad because the MySQL datetime type is not timezone aware, as per this doc.
I think someone has encountered this problem before, because if you scroll a bit down, you can see this issue is patched for the update function
The solution then is to change the create function from
$card->setDuedate($duedate);
to
$card->setDuedate($duedate ? new \DateTime($duedate) : null);
Hope that helps!
I don't know if this is exactly the rather old issue #2276... But I still have the same problem on Nextcloud 26.0.2 (docker) with
TZ=Europe/Vienna
.I'm working on a feature for creating Deck Cards in QOwnNotes (https://github.com/pbek/QOwnNotes/issues/2789).
When I use the Deck API to create a Card, I send:
I get back:
Note that the timezones are both correct,
2023-06-06T06:15:30+02:00
.But when I look at the Deck page on my Nextcloud server, the timezone is not correct at all!
2023-06-06T06:15:30+00:00
I can't see any useful Nextcloud Log errors/warning in that period.