A platform for community discussion. Free, open, simple.
FIX: Align Site Traffic cutoff with chart dates (#42902)
Alan Guo Xiang Tan4d2cbebcf46e
diff --git a/frontend/discourse/admin/components/site-traffic-explorer.gjs b/frontend/discourse/admin/components/site-traffic-explorer.gjsindex 1da4fe85b53..76c3a625090 100644--- a/frontend/discourse/admin/components/site-traffic-explorer.gjs+++ b/frontend/discourse/admin/components/site-traffic-explorer.gjs@@ -174,7 +174,7 @@ export default class SiteTrafficExplorer extends Component {? moment(partial.available_start_date).format("ll"): null;- const pageviewLimitStart = moment(partial.pageview_limit_start_at);+ const pageviewLimitStart = moment.utc(partial.pageview_limit_start_at);const pageviewLimitDate = pageviewLimitStart.format("ll");const pageviewLimitTime = pageviewLimitStart.format("LT");diff --git a/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rb b/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rbindex d79b3e85db4..15719e23bdc 100644--- a/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rb+++ b/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rb@@ -552,15 +552,15 @@ RSpec.describe "Admin Dashboard Redesign | Site Traffic Explorer" doendit "warns an admin when the selected range has incomplete traffic data",- time: Time.zone.local(2026, 5, 14, 12, 0, 0),- timezone: "UTC" do+ time: Time.zone.local(2026, 8, 20, 12, 0, 0),+ timezone: "Asia/Singapore" dosign_in(admin)SiteSetting.site_traffic_explorer_event_limit = 2[- ["/first-retained", "2026-02-15 09:00:00"],- ["/middle-retained", "2026-05-10 10:00:00"],- ["/latest-retained", "2026-05-12 10:00:00"],+ ["/first-retained", "2026-08-17 21:00:00"],+ ["/middle-retained", "2026-08-17 22:27:00"],+ ["/latest-retained", "2026-08-17 23:00:00"],].each do |url, created_at|Fabricate(:browser_pageview_event,@@ -571,11 +571,11 @@ RSpec.describe "Admin Dashboard Redesign | Site Traffic Explorer" do)end- traffic.visit(start_date: "2026-01-01", end_date: "2026-05-12")+ traffic.visit(start_date: "2026-05-01", end_date: "2026-08-17")expect(traffic).to have_partial_data_warning(reason:- "Results include the most recent 2 pageviews, beginning May 10, 2026 at 10:00 AM. Earlier pageviews in the selected date range are not included; pageview data before Feb 14, 2026 is no longer available.",+ "Results include the most recent 2 pageviews, beginning Aug 17, 2026 at 10:27 PM. Earlier pageviews in the selected date range are not included; pageview data before May 20, 2026 is no longer available.",)end