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:
Luke Hagar
2024-01-18 10:14:09 -06:00
committed by GitHub
parent 7f621ed518
commit 6cb5939f9b

View File

@@ -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);