You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A lightweight, responsive calendar widget built with vanilla JavaScript. This project demonstrates DOM manipulation, Date object handling, and local state management without external libraries.
4
+
5
+
## 🚀 Features
6
+
7
+
-**Dynamic Rendering:** Automatically generates the correct grid for any month and year.
8
+
-**Navigation:** Browse through past and future months.
9
+
-**Current Date Highlighting:** visual indicator for today's date.
10
+
-**Event Management (Bonus):** Click any date to add, view, or delete notes.
11
+
-**Data Persistence:** Events are saved to the browser's `localStorage`, so they remain after refreshing the page.
12
+
-**Responsive Design:** Built with CSS Grid to adapt to different screen sizes.
13
+
14
+
## 🛠️ Technologies Used
15
+
16
+
-**HTML5:** Semantic structure.
17
+
-**CSS3:** Flexbox and Grid layout; CSS Variables for theming.
18
+
-**JavaScript (ES6+):** Logic for date calculation and event handling.
19
+
20
+
## 📂 Project Structure
21
+
22
+
```text
23
+
interactive-calendar/
24
+
├── index.html # Main HTML structure
25
+
├── style.css # Styling and Grid layout
26
+
├── script.js # Calendar logic and Event handling
27
+
└── README.md # Project documentation
28
+
29
+
##💡 How It Works
30
+
1. Date Calculation
31
+
The calendar grid is calculated using the native Date object:
32
+
33
+
Start Day: new Date(year, month, 1).getDay() determines which day of the week the month starts on (0=Sunday, 1=Monday).
34
+
35
+
Total Days: new Date(year, month + 1, 0).getDate() retrieves the exact number of days in the current month.
36
+
37
+
2. Rendering the Grid
38
+
We use a loop to generate <div> elements.
39
+
40
+
First, we insert empty placeholder divs to align the 1st of the month with the correct weekday column.
41
+
42
+
Then, we generate the actual numbered days.
43
+
44
+
3. State Management
45
+
Events are stored in a simple JSON object and saved to LocalStorage:
0 commit comments