Merge pull request #1729 from NousResearch/fix/cron-timezone-naive-iso
fix(cron): naive ISO timestamps stored without timezone — jobs fire at wrong time
This commit is contained in:
commit
fb20a9e120
1 changed files with 4 additions and 0 deletions
|
|
@ -168,6 +168,10 @@ def parse_schedule(schedule: str) -> Dict[str, Any]:
|
||||||
try:
|
try:
|
||||||
# Parse and validate
|
# Parse and validate
|
||||||
dt = datetime.fromisoformat(schedule.replace('Z', '+00:00'))
|
dt = datetime.fromisoformat(schedule.replace('Z', '+00:00'))
|
||||||
|
# Make naive timestamps timezone-aware at parse time so the stored
|
||||||
|
# value doesn't depend on the system timezone matching at check time.
|
||||||
|
if dt.tzinfo is None:
|
||||||
|
dt = dt.astimezone() # Interpret as local timezone
|
||||||
return {
|
return {
|
||||||
"kind": "once",
|
"kind": "once",
|
||||||
"run_at": dt.isoformat(),
|
"run_at": dt.isoformat(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue