Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/edisdev/calendar.js
Generate calendar data with javascript 📅
https://github.com/edisdev/calendar.js
calendar calendar-dates javascript
Last synced: 2 months ago
JSON representation
Generate calendar data with javascript 📅
- Host: GitHub
- URL: https://github.com/edisdev/calendar.js
- Owner: edisdev
- Created: 2020-02-08T23:42:49.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-04T07:32:19.000Z (about 4 years ago)
- Last Synced: 2024-10-17T12:34:31.448Z (3 months ago)
- Topics: calendar, calendar-dates, javascript
- Language: JavaScript
- Size: 8.79 KB
- Stars: 11
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# calendar.js
Generate calendar data with javascript 📅## Using
```bash
yarn add calendar-data-generate
```
or```bash
npm install calendar-data-generate
``````javascript
import Calendar from 'calendar-data-generate'
let currentDate = {
year: new Date().getFullYear(),
month: new Date().getMonth(),
date: new Date().getDate(),
firstDayOfWeek: 'monday' // 'sunday' or 'monday',
},let dateFormat = { day: '2-digit', month: 'long', year: 'numeric' }
let disabledStartDate = {
to: new Date(new Date().getTime() - ( 20 * 24 * 60 * 60 * 1000)),
from: new Date(new Date().getTime() - ( 1 * 24 * 60 * 60 * 1000))
},const pickerdata = new Calendar(
currentDate,
language,
dateFormat, // date format
textFormat, // short or long
disabledRange // disabled datas
)
````currentDate` is the value of the first data in months, years, and days.
In addition, the first day of the week is determined here with the `firstDayOfWeek` key.`Language` of the data to be generated
`Date format` is in which format the result of the selected data will be generated.
`TextFormat` is for generating long or short versions of day & month texts.
`disabledRange` is for determine unavailable data. This is an object formed "to" and "from" keys.