Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/twlite/calendar
- Owner: twlite
- Created: 2020-12-06T11:00:34.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-23T12:38:22.000Z (almost 4 years ago)
- Last Synced: 2024-10-06T16:18:15.950Z (about 1 month ago)
- Topics: calendar, javascript-calendar, node-calendar, node-calendar-js
- Language: TypeScript
- Homepage: https://npmjs.com/package/node-calendar-js
- Size: 8.79 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 │ │ │ │ │ │ │
└────────┴────────┴─────────┴───────────┴──────────┴────────┴──────────┘
```