Skip to content

Commit 0163b78

Browse files
committed
fix: array access
1 parent c1bf992 commit 0163b78

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

static/app/views/alerts/rules/metric/details/metricChartOption.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,8 @@ export function getMetricAlertChartOption({
219219
)
220220
: 0;
221221
const startDate = new Date(dataArr[0]?.name);
222-
const endDate = new Date(dataArr[dataArr.length - 1]?.name);
222+
const endDate =
223+
dataArr.length > 1 ? new Date(dataArr[dataArr.length - 1]?.name) : new Date();
223224
const firstPoint = startDate.getTime();
224225
const lastPoint = endDate.getTime();
225226
const totalDuration = lastPoint - firstPoint;

0 commit comments

Comments
 (0)