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

update code and LLM

Supun Lakmal2af8d15c97ac
diff --git a/LLM.md b/LLM.md
index 5ba6557..acb44d0 100644
--- a/LLM.md
+++ b/LLM.md
@@ -1,7 +1,7 @@
# System Role: Hash Calendar Generator
You are an intelligent URL generator for Hash Calendar.
-Base URL: `https://hash-calendar.netlify.app/`
+Base URL: `https://hash-calendar.netlify.app/json.html?json=`
Your job: accept a natural-language schedule request and return a URL that loads the schedule.
@@ -9,9 +9,7 @@ Output rules (must follow exactly):
1. If you can run code to compress JSON: output ONLY two lines:
Title: <calendar title>
- URL: <base_url>#<compressed_payload>
-2. If you cannot run code: output ONLY the JSON payload, then one short sentence:
- "Use LZ-String compressToEncodedURIComponent on this JSON to build the URL."
+ URL: <base_url><json_stringify_payload>
Do not include any other text.
@@ -28,8 +26,8 @@ How to generate the data
3. Convert each event start to minutes since Unix epoch:
startMin = floor(timestamp_ms / 60000)
4. Build the JSON payload using the compact schema below.
-5. Compress the JSON with LZ-String (URI safe) using compressToEncodedURIComponent.
-6. Final URL format: <base_url>#<compressed_payload>
+5. convert json object in to stringify.
+6. Final URL format: <base_url>#<json_stringify_payload>
JSON schema (compact form before compression):
@@ -40,7 +38,7 @@ JSON schema (compact form before compression):
"e": [
[startMin, duration, "Title", colorIndex, "recurrence"]
],
- "s": { "d": 1, "m": 1, "v": "week" },
+ "s": { "d": 1, "m": 1, "v": "month" },
"z": ["UTC"],
"mp": { "h": "UTC", "z": ["UTC"], "s": timestamp_ms, "d": "YYYY-MM-DD", "f24": 1 }
}
@@ -56,16 +54,6 @@ Field notes
- `z`: list of saved timezones (IANA strings). Use `"UTC"` if none is requested.
- `mp`: planner state; set `mp.s` and `mp.d` to the schedule start date.
-Compression rule
+Task -
-- Use LZ-String compressToEncodedURIComponent (URI safe). Do NOT guess the hash.
-
-Optional internal reference (use only if you can run code):
-
-```python
-import json
-# NOTE: Use a real LZ-String implementation. If you do not have it, output JSON only.
-# Example call: LZString().compressToEncodedURIComponent(json.dumps(payload, separators=(',', ':')))
-```
-
-Status: Ready. Ask for a schedule.
+Generate a one-month schedule for me to learn the Python language, starting from February 1, 2026. My target is to gain expert-level knowledge by the end of the month. I need a daily plan where I cover specific parts of Python, ensuring that by the end of the month, I have mastered all Python data concepts.
diff --git a/modules/calendarRender.js b/modules/calendarRender.js
index 0508bf1..70fe83f 100644
--- a/modules/calendarRender.js
+++ b/modules/calendarRender.js
@@ -240,16 +240,16 @@ export function renderTimeGrid({ container, dates, occurrences, onSelectDay, onE
}
}
-export function renderYearView({ container, year, eventsByDay, selectedDate, weekStartsOnMonday, onSelectDay }) {
- container.innerHTML = "";
- container.style.gridTemplateColumns = "repeat(auto-fit, minmax(220px, 1fr))";
- container.style.gridTemplateRows = "auto";
-
- const labels = weekStartsOnMonday
- ? ["M", "T", "W", "T", "F", "S", "S"]
- : ["S", "M", "T", "W", "T", "F", "S"];
-
- for (let month = 0; month < 12; month += 1) {
+export function renderYearView({ container, year, eventsByDay, selectedDate, weekStartsOnMonday, onSelectDay }) {
+ container.innerHTML = "";
+ container.style.gridTemplateColumns = "repeat(auto-fit, minmax(220px, 1fr))";
+ container.style.gridTemplateRows = "auto";
+
+ const labels = weekStartsOnMonday
+ ? ["M", "T", "W", "T", "F", "S", "S"]
+ : ["S", "M", "T", "W", "T", "F", "S"];
+
+ for (let month = 0; month < 12; month += 1) {
const wrapper = document.createElement("div");
wrapper.className = "mini-month";
@@ -261,32 +261,46 @@ export function renderYearView({ container, year, eventsByDay, selectedDate, wee
const grid = document.createElement("div");
grid.className = "mini-grid";
- labels.forEach((label) => {
- const cell = document.createElement("div");
- cell.className = "mini-weekday";
- cell.textContent = label;
- grid.appendChild(cell);
- });
-
- const { dates } = getMonthGridRange(new Date(year, month, 1), weekStartsOnMonday);
- dates.forEach((date) => {
- const key = formatDateKey(date);
- const dayCell = document.createElement("button");
- dayCell.type = "button";
- dayCell.className = "mini-day";
- if (date.getMonth() !== month) dayCell.classList.add("is-outside");
- if (selectedDate && key === formatDateKey(selectedDate)) dayCell.classList.add("is-selected");
- dayCell.textContent = String(date.getDate());
- if (eventsByDay.has(key)) {
- const dot = document.createElement("span");
- dot.className = "mini-dot";
- dayCell.appendChild(dot);
- }
- dayCell.addEventListener("click", () => onSelectDay(date));
- grid.appendChild(dayCell);
- });
-
- wrapper.appendChild(grid);
- container.appendChild(wrapper);
- }
-}
+ labels.forEach((label) => {
+ const cell = document.createElement("div");
+ cell.className = "mini-weekday";
+ cell.textContent = label;
+ grid.appendChild(cell);
+ });
+
+ const firstOfMonth = new Date(year, month, 1);
+ const dayOfWeek = firstOfMonth.getDay();
+ const offset = weekStartsOnMonday ? (dayOfWeek + 6) % 7 : dayOfWeek;
+ const daysInMonth = new Date(year, month + 1, 0).getDate();
+ const totalCells = Math.ceil((offset + daysInMonth) / 7) * 7;
+
+ for (let i = 0; i < totalCells; i += 1) {
+ const dayIndex = i - offset + 1;
+ if (i < offset || dayIndex > daysInMonth) {
+ const emptyCell = document.createElement("div");
+ emptyCell.className = "mini-day is-empty";
+ emptyCell.setAttribute("aria-hidden", "true");
+ grid.appendChild(emptyCell);
+ continue;
+ }
+
+ const date = new Date(year, month, dayIndex);
+ const key = formatDateKey(date);
+ const dayCell = document.createElement("button");
+ dayCell.type = "button";
+ dayCell.className = "mini-day";
+ if (selectedDate && key === formatDateKey(selectedDate)) dayCell.classList.add("is-selected");
+ dayCell.textContent = String(dayIndex);
+ if (eventsByDay.has(key)) {
+ const dot = document.createElement("span");
+ dot.className = "mini-dot";
+ dayCell.appendChild(dot);
+ }
+ dayCell.addEventListener("click", () => onSelectDay(date));
+ grid.appendChild(dayCell);
+ }
+
+ wrapper.appendChild(grid);
+ container.appendChild(wrapper);
+ }
+}
diff --git a/styles.css b/styles.css
index 5fe8e8d..d6688de 100644
--- a/styles.css
+++ b/styles.css
@@ -810,6 +810,11 @@ button:disabled {
position: relative;
}
+.mini-day.is-empty {
+ visibility: hidden;
+ pointer-events: none;
+}
+
.mini-day.is-outside {
color: var(--muted);
}