midbucket date

This commit is contained in:
Alex Holliday committed 2025-12-17 22:44:39 +00:00
1 parent 96567a9818
commit 3f33b302f9
2 files changed
+14 -2

No files matched your search

@@ -88,6 +88,15 @@ export const HistogramStatus = ({
}; };
const avg = d?.avgResponseTime ?? 0; const avg = d?.avgResponseTime ?? 0;
const titleText = t("common.charts.uptime.avgResponseTime"); const titleText = t("common.charts.uptime.avgResponseTime");
const uiTimezone = useAppSelector((state: any) => state.ui.timezone);
const fmt = range === "30d" ? "MMM D, YYYY" : "ddd, MMM D, YYYY, h:mm A";
let dateLabel = "";
if (d?._id) {
const base = new Date(d._id as any);
const midBucket =
range === "30d" ? new Date(base.getTime() + 12 * 60 * 60 * 1000) : base;
dateLabel = formatDateWithTz(midBucket.toISOString(), fmt, uiTimezone);
}
return ( return (
<Stack <Stack
sx={{ sx={{
@@ -98,6 +107,11 @@ export const HistogramStatus = ({
borderRadius: 1, borderRadius: 1,
}} }}
> >
{dateLabel ? (
<Typography sx={{ color: "text.secondary" }} variant="caption">
{dateLabel}
</Typography>
) : null}
<Typography variant="caption">{titleText}</Typography> <Typography variant="caption">{titleText}</Typography>
<Typography variant="body2">{Math.floor(avg)} ms</Typography> <Typography variant="body2">{Math.floor(avg)} ms</Typography>
</Stack> </Stack>
@@ -40,8 +40,6 @@ const UptimeDetailsPage = () => {
{ refreshInterval: GLOBAL_REFRESH, keepPreviousData: true } { refreshInterval: GLOBAL_REFRESH, keepPreviousData: true }
); );
// Up/Down derived from single response (server returns up/down/all in one payload)
const { const {
patch, patch,
loading: isPatching, loading: isPatching,