]> gitweb.hhaalo.de Git - calender.git/commitdiff
add mark weekend days
authorBastian Dehn <hhaalo@arcor.de>
Sat, 18 Dec 2021 20:47:42 +0000 (21:47 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sat, 18 Dec 2021 20:47:42 +0000 (21:47 +0100)
cal.css
stripcalender.mjs

diff --git a/cal.css b/cal.css
index f3a9fd9c6d13f5f7ec3c18c67a2b438dd366fb1d..4e4c6c39672569fd575fe76feec191f8d9f4f8d5 100644 (file)
--- a/cal.css
+++ b/cal.css
@@ -19,3 +19,7 @@ table .row.monthday {
 table .row.weekday {
        background-color: lightgray;
 }
+
+table .weekend {
+       background-color: lightyellow;
+}
index 8b80ace001decc9027c966210f1e4722a902921a..6ad0edef47ffd47546d5e81d7612d3cc27a9286e 100644 (file)
@@ -69,7 +69,13 @@ export class StripCalender
                let th = null;
 
                for (let i = 1; i <= days; i++) {
+                       this._date.setDate(i);
                        th = document.createElement("th");
+
+                       if (this._date.getDay() == 0
+                                       || this._date.getDay() == 6)
+                               th.classList.add("weekend");
+
                        th.innerText = i;
                        tr.appendChild(th);
                }
@@ -98,6 +104,11 @@ export class StripCalender
                for (let i = 1; i <= days; i++) {
                        this._date.setDate(i);
                        th = document.createElement("th");
+
+                       if (this._date.getDay() == 0
+                                       || this._date.getDay() == 6)
+                               th.classList.add("weekend");
+
                        th.innerText = weekday[this._date.getDay()];
                        tr.appendChild(th);
                }