Use yesterday as T-1

This commit is contained in:
Kiro
2026-10-07 16:37:36 +08:00
parent fd3535c217
commit 4740d071c3
2 changed files with 6 additions and 5 deletions
+5 -4
View File
@@ -80,12 +80,13 @@ except Exception:
timezone_name = "UTC"
now = datetime.now(tz)
today = now.date()
# T-5 through T-1. The end boundary is today because Superset treats it as the
# exclusive business-day boundary for this chart's shifted time dimension.
# Use the last completed calendar day as the anchor: T-1 is always yesterday.
# All query windows below therefore exclude today's incomplete data.
today = now.date() - timedelta(days=1)
# T-5 through T-1, where the chart's shifted `dt` values are the five labels
# from five days before today through yesterday.
start_date = today - timedelta(days=5)
time_range = f"{start_date.isoformat()} : {today.isoformat()}"
# The chart's shifted `dt` values label the five returned business days.
requested_dates = [
(today - timedelta(days=offset)).isoformat() for offset in range(4, -1, -1)
]