mirror of
https://github.com/LukeHagar/homepage.git
synced 2025-12-06 04:19:57 +00:00
Remove date time load delay
Setting the date outside of the setInterval allows the date-time to populate immediately, and not after one second.
This commit is contained in:
@@ -23,6 +23,7 @@ export default function DateTime({ options }) {
|
||||
|
||||
useEffect(() => {
|
||||
const dateFormat = new Intl.DateTimeFormat(dateLocale, { ...format });
|
||||
setDate(dateFormat.format(new Date()));
|
||||
const interval = setInterval(() => {
|
||||
setDate(dateFormat.format(new Date()));
|
||||
}, 1000);
|
||||
|
||||
Reference in New Issue
Block a user