bito-code-review[bot] commented on code in PR #38977:
URL: https://github.com/apache/superset/pull/38977#discussion_r3017053892


##########
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:
   <!-- Bito Reply -->
   No, the suggestion isn’t fully correct — using `datetime.now(timezone.utc)` 
would cause a `TypeError` at runtime because Superset stores naive datetimes in 
the database, and you can't subtract offset-aware from offset-naive datetimes. 
The original `AuditMixinNullable._format_time_humanized()` in 
`superset/models/helpers.py` 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]

Reply via email to