home real time update
This commit is contained in:
parent
9c7102dccd
commit
24875f914b
@ -1,5 +1,6 @@
|
|||||||
import Meeting from "./Meeting";
|
import Meeting from "./Meeting";
|
||||||
import Typography from "@mui/material/Typography";
|
import Typography from "@mui/material/Typography";
|
||||||
|
import { useState, useEffect } from "react";
|
||||||
import { useAppSelector } from "../../redux/hooks";
|
import { useAppSelector } from "../../redux/hooks";
|
||||||
import { selectMeetings } from "../../redux/slices/meetingsAndUserStatusSlice";
|
import { selectMeetings } from "../../redux/slices/meetingsAndUserStatusSlice";
|
||||||
import { selectUsers } from "../../redux/slices/usersSlice";
|
import { selectUsers } from "../../redux/slices/usersSlice";
|
||||||
@ -29,7 +30,12 @@ const MeetingsPanel: React.FC = () => {
|
|||||||
const startDatemil = startDate.getTime();
|
const startDatemil = startDate.getTime();
|
||||||
const endDatemil = startDatemil + meeting.duration*60000;
|
const endDatemil = startDatemil + meeting.duration*60000;
|
||||||
const endDate = new Date(endDatemil);
|
const endDate = new Date(endDatemil);
|
||||||
const currentDatemil = Date.now();
|
const [currentDate, setCurrentDate] = useState<Date>(new Date());
|
||||||
|
useEffect(() => {
|
||||||
|
setInterval(() => setCurrentDate(new Date()), 1000);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const currentDatemil = currentDate.getTime();
|
||||||
|
|
||||||
if (currentDatemil >= startDatemil && currentDatemil <= endDatemil) {
|
if (currentDatemil >= startDatemil && currentDatemil <= endDatemil) {
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user