feat: More clock work

Add function to change start of week.
This commit is contained in:
sthag 2025-11-16 13:09:16 +01:00
parent f257a44d89
commit 9e560d7e62

View file

@ -64,12 +64,18 @@ tags:
const currentSeconds = currentDate.getSeconds(); const currentSeconds = currentDate.getSeconds();
const currentMinutes = currentDate.getMinutes(); const currentMinutes = currentDate.getMinutes();
const currentHours = currentDate.getHours(); const currentHours = currentDate.getHours();
const currentDayOfWeek = currentDate.getDay(); // Get current day of the week (0-6, where 0 is Sunday) const currentDayOfWeek = getNumericWeekday(currentDate);
const currentMonth = currentDate.getMonth() + 1; // Get current month (0-11) const currentMonth = currentDate.getMonth() + 1; // Get current month (0-11)
drawCircle(currentSeconds, currentMinutes, currentHours, currentDayOfWeek, currentMonth); drawCircle(currentSeconds, currentMinutes, currentHours, currentDayOfWeek, currentMonth);
} }
// TODO: Parameter für Wochenstart ergänzen
function getNumericWeekday(date) {
const weekday = date.getDay(); // 0 (Sunday) to 6 (Saturday)
return (weekday === 0) ? 7 : weekday;
}
updateCircle(); updateCircle();
setInterval(updateCircle, 1000); setInterval(updateCircle, 1000);
</script> </script>