Skip to content

Commit

Permalink
fix: set default timezone to UTC for cron timezone conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
danielli-ziprecruiter committed Jul 31, 2024
1 parent 4c52ecc commit ef51adf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions superset/tasks/cron_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def cron_schedule_window(
logger.warning("Timezone %s was invalid. Falling back to 'UTC'", timezone)
utc = pytz_timezone("UTC")
# convert the current time to the user's local time for comparison
if not triggered_at.tzinfo:
triggered_at = triggered_at.replace(tzinfo=utc)

Check warning on line 43 in superset/tasks/cron_util.py

View check run for this annotation

Codecov / codecov/patch

superset/tasks/cron_util.py#L43

Added line #L43 was not covered by tests
time_now = triggered_at.astimezone(tz)
start_at = time_now - timedelta(seconds=window_size / 2)
stop_at = time_now + timedelta(seconds=window_size / 2)
Expand Down

0 comments on commit ef51adf

Please sign in to comment.