-
-
Notifications
You must be signed in to change notification settings - Fork 116
Scheduler's CronSpec does not work with datetime.timezone offset #605
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Taskiq version
0.12.1
Python version
Python 3.13
OS
macOS
What happened?
When serializing and subsequently validating CronSpec with offset as datetime.timezone, the validated instance contains string representation of the offset, which is not valid:
>>> CronSpec.model_validate(CronSpec(offset=datetime.datetime.now().astimezone().tzinfo.utcoffset(None)).model_dump(mode="json"))
CronSpec(minutes='*', hours='*', days='*', months='*', weekdays='*', offset='PT2H')
>>> datetime.datetime.now().astimezone().tzinfo.utcoffset(None)
datetime.timedelta(seconds=7200)
Kicking the tasks uses .model_dump(mode="json"), which is what breaks the timezone-typed value.
Relevant log output
Broker initialization code
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working