forked from Github/frigate
WebUI Improvements and fixes (#9613)
* Show toast instead of text for success and errors * Show correct times * Start playing next hour when current hour ends * Fix refreshing camera image * Fix timeline
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user