Recordings Fixes (#13005)

* If recordings don't exist mark as no recordings

* Fix reloading recordings failing

* Fix mark items not clearing selected

* Cleanup

* Default to last full hour when error occurs

* Remove check

* Cleanup

* Handle empty recordings list case

* Ensure that the start time is within the time range

* Catch other reset cases
This commit is contained in:
Nicolas Mowen
2024-08-12 14:30:16 -06:00
committed by GitHub
parent 132a712341
commit 281482927a
4 changed files with 36 additions and 7 deletions

View File

@@ -101,7 +101,7 @@ export default function Events() {
// review paging
const [beforeTs, setBeforeTs] = useState(Date.now() / 1000);
const [beforeTs, setBeforeTs] = useState(Math.ceil(Date.now() / 1000));
const last24Hours = useMemo(() => {
return { before: beforeTs, after: getHoursAgo(24) };
}, [beforeTs]);
@@ -455,5 +455,5 @@ export default function Events() {
function getHoursAgo(hours: number): number {
const now = new Date();
now.setHours(now.getHours() - hours);
return now.getTime() / 1000;
return Math.ceil(now.getTime() / 1000);
}