I'm building an application in which some tasks are scheduled by using CRON like jobs (with celery). Through an interface, jobs are saved as celery jobs with django-celery-beat package.
For that, the schedule the users want is translated into a CRON expression such as 30 9 * * 1
(Every Monday at 9:30).
It works well. But the celery backend as well as the database are working in UTC timezone. While end users of my application way work from a different timezone.
So if a user is working in UTC+1, and he wants the job to be run at 9:30 each Monday, it's not 30 9 * * 1
that will have to be used but 30 8 * * 1
instead.
This use case is kinda easy to solve but what if I want it to be run at 00:00 on each Monday ? It means that I'll have to go a day backwards, so Sunday at 23:00 which would lead to 0 23 * * 0
. And the same behavior for every possible timezone other than UTC.
Is there an easy way to do so ?
Also I'm worryied about DST...
Thanks in advance !