diff --git a/pkg/ui/workspaces/db-console/src/views/cluster/components/linegraph/index.tsx b/pkg/ui/workspaces/db-console/src/views/cluster/components/linegraph/index.tsx index 6c8da288be35..770ccb89372a 100644 --- a/pkg/ui/workspaces/db-console/src/views/cluster/components/linegraph/index.tsx +++ b/pkg/ui/workspaces/db-console/src/views/cluster/components/linegraph/index.tsx @@ -207,9 +207,11 @@ export class LineGraph extends React.Component { start: moment.unix(start), end: moment.unix(end), }; + const seconds = moment.duration(moment.utc(end).diff(start)).asSeconds(); let newTimeScale: TimeScale = { - ...findClosestTimeScale(defaultTimeScaleOptions, end - start, start), + ...findClosestTimeScale(defaultTimeScaleOptions, seconds), key: "Custom", + windowSize: moment.duration(moment.unix(end).diff(moment.unix(start))), fixedWindowEnd: moment.unix(end), }; if (this.props.adjustTimeScaleOnChange) {