Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 03b1fa5

Browse files
committed
also lock the default endDate
1 parent 928ed56 commit 03b1fa5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsPage.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ import {
2525
useId,
2626
} from "react";
2727
import chroma from "chroma-js";
28-
import { subDays, addWeeks, format, startOfDay } from "date-fns";
28+
import {
29+
subDays,
30+
addWeeks,
31+
format,
32+
startOfDay,
33+
startOfHour,
34+
addHours,
35+
} from "date-fns";
2936
import { useSearchParams } from "react-router-dom";
3037
import "react-date-range/dist/styles.css";
3138
import "react-date-range/dist/theme/default.css";
@@ -152,7 +159,8 @@ const getDateRange = (
152159
const today = new Date();
153160
return {
154161
startDate: startOfDay(subDays(today, 6)),
155-
endDate: today,
162+
// Add one hour to endDate to include real-time data for today.
163+
endDate: addHours(startOfHour(today), 1),
156164
};
157165
}
158166

0 commit comments

Comments
 (0)