I want to display the current time on a webpage with Flask. At the moment I have this code which displays the current time but does not update unless the user explicitly refresh the page.
<div id="datetime">
<h2>{{ moment().format('HH:mm', refresh=True)}}</h2>
<h2>{{ moment().format('ddd DD/MM/YY', refresh=True) }}</h2>
</div>
I am aware that the refresh option only re-renders the time and does not update it. How can I make it that the time stays up-to-date?