added about page

learned about updating values with set interval
This commit is contained in:
Nico Melone
2025-01-22 08:35:46 -06:00
parent 1222be277d
commit 674f30cbd8
6 changed files with 33 additions and 0 deletions

26
templates/about.html Normal file
View File

@@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block content %}
<h1 id="datetime" data-time="{{now.isoformat()}}">{{now.isoformat()}}</h1>
<script>
// JavaScript to update the datetime dynamically
function updateTime() {
const dateElement = document.getElementById('datetime');
const currentTime = new Date(dateElement.dataset.time);
// Increment the datetime by 1 second
currentTime.setSeconds(currentTime.getSeconds() + 1);
// Format the datetime as a readable string
const formattedTime = currentTime.toLocaleString();
// Update the displayed datetime
dateElement.textContent = formattedTime;
// Update the data-time attribute for the next update
dateElement.dataset.time = currentTime.toISOString();
}
// Update the datetime every second
setInterval(updateTime, 1000);
</script>
{% endblock %}