Code Monkey home page Code Monkey logo

calendar's Introduction

Calendar

Simple JavaScript calendar library.

Installation

Node

$ npm i node-calendar-js

Example

Node

const { Calendar } = require("node-calendar-js");

const calendar = new Calendar({
    year: 2021,
    month: 0
});

console.log(calendar.create());

Deno

import Calendar from "https://deno.land/x/calendar/mod.ts";

const calendar = new Calendar({
    year: 2021,
    month: 0
});

console.log(calendar.create());

Creating HTML output

const calendar = new Calendar({
    year: 2021,
    month: 0
});

console.log(calendar.toHTML());

Output

raw

<table width="100%"><caption>January 2021</caption><thead><tr><th class="sunday">Sunday</th><th class="monday">Monday</th><th class="tuesday">Tuesday</th><th class="wednesday">Wednesday</th><th class="thursday">Thursday</th><th class="friday">Friday</th><th class="saturday">Saturday</th></tr></thead><tbody><tr><td class="day"></td><td class="day"></td><td class="day"></td><td class="day"></td><td class="day"></td><td class="day">1</td><td class="day">2</td></tr><tr><td class="day holiday">3</td><td class="day">4</td><td class="day">5</td><td class="day">6</td><td class="day">7</td><td class="day">8</td><td class="day">9</td></tr><tr><td class="day holiday">10</td><td class="day">11</td><td class="day">12</td><td class="day">13</td><td class="day">14</td><td class="day">15</td><td class="day">16</td></tr><tr><td class="day holiday">17</td><td class="day">18</td><td class="day">19</td><td class="day">20</td><td class="day">21</td><td class="day">22</td><td class="day">23</td></tr><tr><td class="day holiday">24</td><td class="day">25</td><td class="day">26</td><td class="day">27</td><td class="day">28</td><td class="day">29</td><td class="day">30</td></tr><tr><td class="day holiday">31</td><td class="day"></td><td class="day"></td><td class="day"></td><td class="day"></td><td class="day"></td><td class="day"></td></tr></tbody></table>

Preview

January 2021
SundayMondayTuesdayWednesdayThursdayFridaySaturday
12
3456789
10111213141516
17181920212223
24252627282930
31

String

const calendar = new Calendar({
    year: 2021,
    month: 0
});

console.log(calendar.toString());

Output

╔═════════╤══════╗
║ January │ 2021 ║
╚═════════╧══════╝
┌────────┬────────┬─────────┬───────────┬──────────┬────────┬──────────┐
│ Sunday │ Monday │ Tuesday │ Wednesday │ Thursday │ Friday │ Saturday │
├────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┤
│        │        │         │           │          │ 1      │ 2        │
├────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┤
│ 3      │ 4      │ 5       │ 6         │ 7        │ 8      │ 9        │
├────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┤
│ 10     │ 11     │ 12      │ 13        │ 14       │ 15     │ 16       │
├────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┤
│ 17     │ 18     │ 19      │ 20        │ 21       │ 22     │ 23       │
├────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┤
│ 24     │ 25     │ 26      │ 27        │ 28       │ 29     │ 30       │
├────────┼────────┼─────────┼───────────┼──────────┼────────┼──────────┤
│ 31     │        │         │           │          │        │          │
└────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────┘

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.