bucket date

This commit is contained in:
Alex Holliday committed 2026-01-26 03:19:33 +00:00
1 parent 174665e70a
commit 11c95f885d
8 files changed
+24 -13

No files matched your search

@@ -28,7 +28,7 @@ export const MonitorStatBoxes = ({
const timeSinceLastFailure =
timeOfLastFailure > 0
? Date.now() - timeOfLastFailure
: Date.now() - new Date(monitorStats?.createdAt);
: Date.now() - new Date(monitorStats?.createdAt || 0).getTime();
// Determine time since last check
const timeOfLastCheck = monitorStats?.lastCheckTimestamp || 0;
@@ -131,7 +131,7 @@ export const HistogramDetails = ({
<XAxis
axisLine={false}
tickLine={false}
dataKey="_id"
dataKey="bucketDate"
tick={(props) => (
<XTick
{...props}
@@ -31,7 +31,7 @@ const XLabel = ({ p1, p2, range }: XLabelProps) => {
fontSize={11}
fill={theme.palette.text.secondary}
>
{formatDateWithTz(p1._id, dateFormat, uiTimezone)}
{formatDateWithTz(p1.bucketDate, dateFormat, uiTimezone)}
</text>
<text
x="100%"
@@ -41,7 +41,7 @@ const XLabel = ({ p1, p2, range }: XLabelProps) => {
fontSize={11}
fill={theme.palette.text.secondary}
>
{formatDateWithTz(p2._id, dateFormat, uiTimezone)}
{formatDateWithTz(p2.bucketDate, dateFormat, uiTimezone)}
</text>
</>
);
@@ -78,8 +78,8 @@ export const HistogramStatus = ({
const titleText = t("common.charts.labels.averageResponseTime");
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);
if (d?.bucketDate) {
const base = new Date(d.bucketDate);
const midBucket =
range === "30d" ? new Date(base.getTime() + 12 * 60 * 60 * 1000) : base;
dateLabel = formatDateWithTz(midBucket.toISOString(), fmt, uiTimezone);
@@ -151,11 +151,11 @@ export const HistogramStatus = ({
maxBarSize={7}
background={{ fill: "transparent" }}
>
{checks?.map((groupedCheck) => {
{checks?.map((groupedCheck, index) => {
const fillColor = getResponseTimeColor(groupedCheck.avgResponseTime);
return (
<Cell
key={groupedCheck._id}
key={groupedCheck.bucketDate || `check-${index}`}
fill={theme.palette[fillColor].main}
/>
);