mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
3c9679dff9
* chore: update dashboard and profile time in realtime * chore: remove seconds * fix: cycle and module sidebar datepicker
18 lines
391 B
TypeScript
18 lines
391 B
TypeScript
import { useEffect, useState } from "react";
|
|
|
|
export const useCurrentTime = () => {
|
|
const [currentTime, setCurrentTime] = useState(new Date());
|
|
// update the current time every second
|
|
useEffect(() => {
|
|
const intervalId = setInterval(() => {
|
|
setCurrentTime(new Date());
|
|
}, 1000);
|
|
|
|
return () => clearInterval(intervalId);
|
|
}, []);
|
|
|
|
return {
|
|
currentTime,
|
|
};
|
|
};
|