hasura / hasura/graphql-engine

Cron trigger is adding timezone difference to scheduled_time

Open
#9,749 2 comments 0 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Version: v2.26.0

### What is the current behaviour?

When I create a cron trigger (either using metadata api or hasura console) using a cron expression, hasura is adding timezone difference to scheduled_time. created_at is being created as expected. This makes the scheduling all wrong and trigger wont execute at the expected time.

For example,

If I create a cron trigger with expression : 30 12 * * 3 , it is expected to create a trigger with scheduled_time at 12.30 pm every Wednesday. But what actually happens is that my time zone difference (+5:30 India) is being added to scheduled_time and the resulting schedule will be 6:00 pm every Wednesday. And the event wont fire until 6pm and not 12.30 pm

### What is the expected behaviour?
Cron trigger should work at provided time.

For example,

If I create a cron trigger with expression : 30 12 * * 3 , it is expected to create a trigger with scheduled_time at 12.30 pm every Wednesday.

### How to reproduce the issue?

1. Be in India timezone( or any other)
2. Create a cron trigger using frequently used crons Every Friday noon
3. Check pending events to see the scheduled time as 17:30 instead of 12:00
4. Event wont fire till 17:30

### Screenshots or Screencast
![1](https://github.com/hasura/graphql-engine/assets/103171398/c92d722e-bfbf-40b0-97e3-3bf48581c920)

![image](https://github.com/hasura/graphql-engine/assets/103171398/ec4f3a6a-23bd-4f42-a3ae-bbcde52e2486)

### Any possible solutions/workarounds you're aware of?

I can only think of wring some logic to manually convert cron to -5:30 based on my time zone.

### Keywords

cron_trigger
scheduled_time
utc timezone

Please let me know if it is a know issue or if there are any reported workarounds or solutions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.