diff --git a/src/components/widgets/datetime/datetime.jsx b/src/components/widgets/datetime/datetime.jsx index dceaf06a3..7bfb42bce 100644 --- a/src/components/widgets/datetime/datetime.jsx +++ b/src/components/widgets/datetime/datetime.jsx @@ -15,22 +15,21 @@ const textSizes = { export default function DateTime({ options }) { const { text_size: textSize, format } = options; const { i18n } = useTranslation(); - const [date, setDate] = useState(new Date()); - + const dateFormat = new Intl.DateTimeFormat(i18n.language, { ...format }); + const [date, setDate] = useState(""); + useEffect(() => { const interval = setInterval(() => { - setDate(new Date()); + setDate(dateFormat.format(new Date())); }, 1000); return () => clearInterval(interval); - }, [setDate]); - - const dateFormat = new Intl.DateTimeFormat(i18n.language, { ...format }); + }, [date, setDate]); return (