mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-08 12:15:25 +03:00
Fix timeline
This commit is contained in:
parent
ccfa663b14
commit
d1e72154c4
@ -284,8 +284,13 @@ export function getRangeForTimestamp(timestamp: number) {
|
||||
date.setHours(date.getHours() + 1);
|
||||
|
||||
// ensure not to go past current time
|
||||
const end = Math.min(new Date().getTime() / 1000, date.getTime() / 1000);
|
||||
return { start, end };
|
||||
return { start, end: endOfHourOrCurrentTime(date.getTime() / 1000) };
|
||||
}
|
||||
|
||||
export function endOfHourOrCurrentTime(timestamp: number) {
|
||||
const now = new Date();
|
||||
now.setMilliseconds(0);
|
||||
return Math.min(timestamp, now.getTime() / 1000);
|
||||
}
|
||||
|
||||
export function isCurrentHour(timestamp: number) {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { endOfHourOrCurrentTime } from "./dateUtil";
|
||||
|
||||
// group history cards by 120 seconds of activity
|
||||
const GROUP_SECONDS = 120;
|
||||
|
||||
@ -169,7 +171,7 @@ export function getTimelineHoursForDay(
|
||||
break;
|
||||
}
|
||||
|
||||
end = startDay.getTime() / 1000;
|
||||
end = endOfHourOrCurrentTime(startDay.getTime() / 1000);
|
||||
const hour = Object.values(day).find((cards) => {
|
||||
const card = Object.values(cards)[0];
|
||||
if (card == undefined || card.time < start || card.time > end) {
|
||||
|
||||
@ -180,9 +180,7 @@ export default function DesktopTimelineView({
|
||||
timeline.range.start == selectedPlayback.range.start;
|
||||
const graphData = timelineGraphData[timeline.range.start];
|
||||
const start = new Date(timeline.range.start * 1000);
|
||||
const end = new Date(
|
||||
Math.min(timeline.range.end * 1000, new Date().getTime())
|
||||
);
|
||||
const end = new Date(timeline.range.end * 1000);
|
||||
|
||||
return (
|
||||
<div
|
||||
|
||||
Loading…
Reference in New Issue
Block a user