Scheduler timezone bug when comparing dates?

Infos:

  • Used Zammad version: 5.2.x
  • Used Zammad installation type: docker-compose
  • Operating system: Debian 11 bullseye
  • Browser + version: Firefox 102

Expected behavior:

  • A scheduler job scheduled for 01:00 should match a “<custom date field> before (relative) 1 minute(s)” condition when the date is today.

Actual behavior:

  • The condition doesn’t match on that day, but only the next day.

Steps to reproduce the behavior:

  • We have a custom date field “followup” on our Ticket object:

    This is used as an alternative way to the “pending reminder” ticket state to reopen a ticket on a certain date, regardless of the ticket state.

  • A scheduler is supposed to reopen tickets on that day:


  • This has stopped working after a recent update:

    Martin von Wittich - 2022-07-26 17:58

    updated Ticket State from 'open' → 'closed'
    updated Ticket last_owner_update_at '01/11/2021 19:38' → '-'
    updated Ticket Wiedervorlage '2022-07-27'
    

    - 2022-07-28 01:01

    updated Ticket State from 'closed' → 'open'
    updated Ticket last_owner_update_at '07/28/2022 01:01'
    updated Ticket Wiedervorlage '2022-07-27' → '-'
    created Article
    notification Ticket 'martin.von.wittich@iserv.eu(update:online)'
    

    I would have expected the scheduler to reopen the ticket on 2022-07-27 01:01, but instead it only reopened the ticket on 2022-07-28 01:01.

Apparently, the scheduler runs correctly at the configured time (the ticket history says 01:01 which matches the scheduler configuration), but it doesn’t match the condition.

I believe that this is a timezone bug - our local timezone is CEST (UTC+2), so when the scheduler is running at 2022-07-27 01:01 UTC+2, it’s internally probably thinking in UTC, and so it sees the current time as 2022-07-26 23:01 UTC. It then probably compares the date field “2022-07-27” with “2022-07-26 23:01 UTC” and this results in the condition not matching. It works on the next day because then it’ll compare the date field “2022-07-27” with “2022-07-27 23:01 UTC”.

I suspect that the following change might be responsible for the issue:

Changelog

  • Job scheduling respects time zone 3802

Can anyone confirm that this is indeed a bug, or am I barking up the wrong tree?

Scheduler tasks display to be configured times in your timezone - that is if you create new tasks - migrated ones don’t count.

That being said. Europe/Berlin currently is, due to summertime, UTC+2.
Zammad stores all dates in UTC which makes your task run at 23:00 your local time. This is why the task does not do what you expect it to do.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.