Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/twlite/calendar

Simple JavaScript calendar library.
https://github.com/twlite/calendar

calendar javascript-calendar node-calendar node-calendar-js

Last synced: about 1 month ago
JSON representation

Simple JavaScript calendar library.

Awesome Lists containing this project

README

        

# Calendar
Simple JavaScript calendar library.

# Installation
## Node

```sh
$ npm i node-calendar-js
```

# Example
## Node

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

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

console.log(calendar.create());
```

## Deno

```js
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

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

console.log(calendar.toHTML());
```

### Output
**raw**
```html
January 2021SundayMondayTuesdayWednesdayThursdayFridaySaturday12345678910111213141516171819202122232425262728293031
```

**Preview**
January 2021SundayMondayTuesdayWednesdayThursdayFridaySaturday12345678910111213141516171819202122232425262728293031

## String

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

console.log(calendar.toString());
```

### Output

```xl
╔═════════╤══════╗
║ 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 │ │ │ │ │ │ │
└────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────┘
```