feat: Add day of week and month to clock
This commit is contained in:
parent
847c4a9f6b
commit
f257a44d89
1 changed files with 6 additions and 2 deletions
|
|
@ -29,7 +29,7 @@ tags:
|
|||
document.getElementById('toggleFormat').textContent = is24HourFormat ? '12-Stunden-Format' : '24-Stunden-Format';
|
||||
});
|
||||
|
||||
function drawCircle(seconds, minutes, hours) {
|
||||
function drawCircle(seconds, minutes, hours, dayOfWeek, month) {
|
||||
const centerX = canvas.width / 2;
|
||||
const centerY = canvas.height / 2;
|
||||
const radius = 128;
|
||||
|
|
@ -55,6 +55,8 @@ tags:
|
|||
radius - 40,
|
||||
'white'
|
||||
);
|
||||
drawArc(dayOfWeek, 7, radius - 60, '#fad803');
|
||||
drawArc(month, 12, radius - 80, '#d30a51');
|
||||
}
|
||||
|
||||
function updateCircle() {
|
||||
|
|
@ -62,8 +64,10 @@ tags:
|
|||
const currentSeconds = currentDate.getSeconds();
|
||||
const currentMinutes = currentDate.getMinutes();
|
||||
const currentHours = currentDate.getHours();
|
||||
const currentDayOfWeek = currentDate.getDay(); // Get current day of the week (0-6, where 0 is Sunday)
|
||||
const currentMonth = currentDate.getMonth() + 1; // Get current month (0-11)
|
||||
|
||||
drawCircle(currentSeconds, currentMinutes, currentHours);
|
||||
drawCircle(currentSeconds, currentMinutes, currentHours, currentDayOfWeek, currentMonth);
|
||||
}
|
||||
|
||||
updateCircle();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue