datewise
v1.0.7
Published
Calendar for javascript (type script) projects.
Downloads
569
Maintainers
Readme
This calendar is intended to be consumed for all of type javascript projects.
Table of contents
Installation
$ npm install datewise
coming soon in cdnjs
Usage
import Calendar, { ICalendar, IDay,TDateStatus } from 'datewise';
const calendar: ICalendar = new Calendar();
Arguments
| Type | Default value |
| ------------- | -------------------------- |
| Date {Object} | new Date() |
| Intl locales | 'en-US' |
Calendar Methods
| Method | argument | return type | | ----------- | ------------- | ------------ | | toDate | Date {Object} | void | | toPrevMonth | none | void | | toNextMonth | none | void | | toNextYear | none | void | | toPrevYear | none | void | | changeLocale| locale:string | void |
Day Methods
| Method | argument | return type | | ----------- | ------------- | ------------ | | isWeekDay | none | boolean |
Example:
const calendar = new Calendar();
const btn = document.getElementByTabName('button')[0];
btn.onclick = () => {
calendar.toDate(new Date(2025, 5, 16), 'en');
// calendar.toPrevMonth();
// calendar.toNextMonth();
// calendar.toNextYear();
// calendar.toPrevYear();
// calendar.changeLocale('en');
calendar.days[0].isWeekDay() // boolean
};
Calendar Object
| keys | values | example | | -------- | ------------- | -------- | | locale | string | 'en-US' | | value | Date {Object} | new Date() | | selected | Date {Object} | new Date() | | months | string[] | ["January",...] | | weekDays | string[] | ["Saturday",...] | | days | Day[] | new Day() |
Day Object
| keys | values | example | | -------- | ------------- | -------- | | date | Date {Object} | new Date() | | status | TDateStatus | 'current-month' |
Author
- Gagik - Initial work - Gagik-arch