fix greeting to finally respect the time

This commit is contained in:
Sören Oesterwind 2023-07-07 22:15:50 +02:00
parent 5d99baea8e
commit c026b5f1a8

View File

@ -1,6 +1,19 @@
<%~ E.includeFile("partials/head.eta.html", {"title": "Dashboard"}) %> <%~ E.includeFile("partials/controls.eta.html", {"active": "Dashboard"}) %> <%~ E.includeFile("partials/head.eta.html", {"title": "Dashboard"}) %> <%~ E.includeFile("partials/controls.eta.html", {"active": "Dashboard"}) %>
<h1 onclick="doTheConfetti()" class="user-select-none">Good evening, ${user}</h1> <h1 onclick="doTheConfetti()" class="user-select-none" id="greeting">Good evening, ${user}</h1>
<script>
// Handle greeting
var today = new Date();
var curHr = today.getHours();
if (curHr < 12) {
document.getElementById("greeting").innerHTML = "Good morning";
} else if (curHr < 18) {
document.getElementById("greeting").innerHTML = "Good afternoon";
} else {
document.getElementById("greeting").innerHTML = "Good evening";
}
</script>
<div class="container text-center"> <div class="container text-center">
<div class="row"> <div class="row">
<div class="card col m-2"> <div class="card col m-2">