├── README.md ├── calendarize.js ├── script.js └── index.html /README.md: -------------------------------------------------------------------------------- 1 | Minimal, printer-friendly, monthly calendar. 2 | 3 | Uses the tiny [calendarize](https://github.com/lukeed/calendarize) project. -------------------------------------------------------------------------------- /calendarize.js: -------------------------------------------------------------------------------- 1 | /* 2 | MIT License 3 | 4 | Copyright (c) Luke Edwards (lukeed.com) 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 11 | */ 12 | 13 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.calendarize=t()}(this,function(){return function(e,t){for(var n,o=0,f=0,r=[],a=new Date(e||new Date),u=a.getFullYear(),i=a.getMonth(),d=new Date(u,i,1-(0|t)).getDay(),c=new Date(u,i+1,0).getDate();oc?0:o,d=0}r.push(n)}return r}}); -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | var months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] 2 | 3 | 4 | function renderCalendar(d) { 5 | try { 6 | document.querySelector("#cal").innerHTML = ""; 7 | } catch { 8 | let el = document.createElement("div"); 9 | el.id = "cal"; 10 | document.querySelector("main").appendChild(el); 11 | } 12 | 13 | let date = new Date(d); 14 | 15 | let headingEl = document.querySelector("h1"); 16 | headingEl.innerHTML = months[date.getMonth()]; 17 | 18 | let yearEl = document.querySelector("h2"); 19 | yearEl.innerHTML = date.getFullYear(); 20 | 21 | let calendar = calendarize(d); 22 | let calendarEl = document.querySelector("#cal"); 23 | 24 | let days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]; 25 | for (let d of days) { 26 | let label = document.createElement("div"); 27 | label.className = "dayLabel"; 28 | label.innerText = d; 29 | calendarEl.appendChild(label); 30 | } 31 | 32 | for (let i in calendar) { 33 | let week = calendar[i]; 34 | for (let day of week) { 35 | let el = document.createElement("div"); 36 | el.className = i == calendar.length - 1 ? "last-week day" : "day"; 37 | el.innerHTML = day != 0 ? day : " "; 38 | calendarEl.appendChild(el); 39 | } 40 | } 41 | } 42 | 43 | document.querySelector("#start").onchange = (e) => { 44 | renderCalendar(e.target.value); 45 | } 46 | 47 | renderCalendar(new Date()); 48 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Quick Printable Calendar 8 | 9 | 10 | 11 | 12 | 82 | 83 | 84 |
85 | 89 |

1999

90 |

January

91 |
92 | 93 | 94 | 95 | 96 | 97 | --------------------------------------------------------------------------------