aminghadersohi commented on code in PR #38977:
URL: https://github.com/apache/superset/pull/38977#discussion_r3017042229
##########
superset/mcp_service/dashboard/schemas.py:
##########
@@ -515,6 +516,13 @@ def dashboard_serializer(dashboard: "Dashboard") ->
DashboardInfo:
)
+def _humanize_timestamp(dt: datetime | None) -> str | None:
+ """Convert a datetime to a humanized string like '2 hours ago'."""
+ if dt is None:
+ return None
+ return humanize.naturaltime(datetime.now() - dt)
Review Comment:
This is intentional — Superset stores naive (non-timezone-aware) datetimes
in the database. Using `datetime.now(timezone.utc)` causes `TypeError: can't
subtract offset-naive and offset-aware datetimes` at runtime. The original
`AuditMixinNullable._format_time_humanized()` in
`superset/models/helpers.py:632` also uses naive `datetime.now()` for the same
reason.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]