-
Notifications
You must be signed in to change notification settings - Fork 18
introduce timezone for CRON #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -2,10 +2,12 @@ | |||||
|
||||||
from dataclasses import dataclass | ||||||
from datetime import datetime | ||||||
from typing import Any, Dict, Mapping, Union | ||||||
from typing import Any, Dict, Literal, Mapping, Union | ||||||
|
||||||
import rich.repr | ||||||
|
||||||
DEFAULT_TIMEZONE = "America/Los_Angeles" | ||||||
|
||||||
|
||||||
class _trigger_time: | ||||||
""" | ||||||
|
@@ -33,9 +35,14 @@ class Cron: | |||||
""" | ||||||
|
||||||
expression: str | ||||||
timezone: Literal["America/Los_Angeles", "Europe/London", "Australia/Sydney", "America/New_York"] = DEFAULT_TIMEZONE | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why these 4? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This would be extended to all the timezones |
||||||
|
||||||
@property | ||||||
def timezone_expression(self) -> str: | ||||||
return f"{self.timezone} {self.expression}" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it must be
Suggested change
for example: |
||||||
|
||||||
def __str__(self): | ||||||
return f"Cron Trigger: {self.expression}" | ||||||
return f"Cron Trigger: {self.timezone_expression}" | ||||||
|
||||||
|
||||||
@rich.repr.auto | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be utc - no time zone to preserve current behavior
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah easy to default to UTC