mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 01:05:20 +03:00
fix: replace time search with 24 hour
This commit is contained in:
parent
072f52b061
commit
46020693cd
@ -1,5 +1,5 @@
|
||||
import { Fragment, h } from 'preact';
|
||||
import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'preact/hooks';
|
||||
import { useApiHost, useEvents } from '../api';
|
||||
import { useSearchString } from '../hooks/useSearchString';
|
||||
import { Next } from '../icons/Next';
|
||||
@ -9,13 +9,15 @@ import { HistoryHeader } from '../routes/HistoryHeader';
|
||||
import { longToDate } from '../utils/dateUtil';
|
||||
import Timeline from './Timeline';
|
||||
|
||||
const getLast24Hours = () => {
|
||||
return new Number(new Date(new Date().getTime() - 24 * 60 * 60 * 1000)) / 1000;
|
||||
};
|
||||
|
||||
export default function HistoryViewer({ camera }) {
|
||||
console.log('history', { camera });
|
||||
const apiHost = useApiHost();
|
||||
const videoRef = useRef();
|
||||
|
||||
// const beginningOfDay = new Date().setHour(0, 0, 0) / 1000;
|
||||
const beginningOfDay = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
|
||||
const { searchString } = useSearchString(200, `camera=${camera}&after=${beginningOfDay}`);
|
||||
const { searchString } = useSearchString(200, `camera=${camera}&after=${getLast24Hours()}`);
|
||||
const { data: events } = useEvents(searchString);
|
||||
const [timelineEvents, setTimelineEvents] = useState();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user