Skip to content

lightweight, client-only calendar web application. All data persists in the URL hash for instant sharing, No backend required. Optional AES-GCM password protection keeps shared links locked without a server

JavaScript

fix issue for month

Supun Lakmal68a4b6a21fe5
diff --git a/script.js b/script.js
index 0a1714a..f4b7340 100644
--- a/script.js
+++ b/script.js
@@ -943,17 +943,23 @@ function renderEventList() {
});
}
-function handleSelectDay(date) {
- selectedDate = startOfDay(date);
- if (currentView === "month") {
- if (date.getMonth() !== viewDate.getMonth() || date.getFullYear() !== viewDate.getFullYear()) {
- viewDate = new Date(date.getFullYear(), date.getMonth(), 1);
- }
- } else {
- viewDate = startOfDay(date);
- }
- render();
-}
+function handleSelectDay(date) {
+ selectedDate = startOfDay(date);
+ if (currentView === "month") {
+ if (ui.calendarGrid) {
+ const previous = ui.calendarGrid.querySelector(".day-cell.is-selected");
+ if (previous) previous.classList.remove("is-selected");
+ const key = formatDateKey(selectedDate);
+ const next = ui.calendarGrid.querySelector(`.day-cell[data-date="${key}"]`);
+ if (next) next.classList.add("is-selected");
+ }
+ renderEventList();
+ return;
+ }
+
+ viewDate = startOfDay(date);
+ render();
+}
function openEventModal({ index = null, date = null } = {}) {
if (!ui.eventModal) return;