Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes datetimes to be generous on either side for default run view #909

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions ui/frontend/src/components/dashboard/Runs/RunSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,15 @@ export const RunSummary = (props: {
run.run_start_time ? new Date(run.run_start_time) : new Date(Date.now())
)
.sort((a, b) => a.getTime() - b.getTime());
const minDate = runsSortedByStartDate[0];
const maxDate = runsSortedByStartDate[runsSortedByStartDate.length - 1];
const minDate = new Date(runsSortedByStartDate[0]);
const maxDate = new Date(
runsSortedByStartDate[runsSortedByStartDate.length - 1]
);

// Quick buffer to ensure no runs are missed
minDate.setDate(minDate.getDate() - 1);
maxDate.setDate(maxDate.getDate() + 1);

const [searchParams, setSearchParams] = useSearchParams();
const [query, setQuery] = useState(() =>
deserialize(searchParams, minDate, maxDate)
Expand All @@ -663,14 +670,6 @@ export const RunSummary = (props: {
const newSearchParams = serialize(query);
setSearchParams(newSearchParams, { replace: true });
}, [query, setSearchParams]);
// const [query, setQuery] = useState<Query>({
// selectedTags: new Map<string, Set<string>>(),
// dateRange: {
// startDate: addDays(minDate, -1),
// endDate: addDays(maxDate, +1),
// },
// statuses: new Set<string>(),
// });
const filteredRuns = filterOnQuery(props.runs, query);
// const filteredRuns = props.runs
return (
Expand Down
Loading