1.0.8 • Published 5 months ago
This calendar is intended to be consumed for all of type javascript projects.
Table of contents
Installation
$ npm install datewise
We need stars (🌟🌟🌟🌟) to make available the package in cdnjs
please add star in git repository thank you all.
Usage
import Calendar, { ICalendar, IDay } 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 |
---|
isWeekEnd | none | boolean |
Example:
const calendar = new Calendar();
const btn = document.getElementByTabName('button')[0];
btn.onclick = () => {
calendar.toDate(new Date(2025, 5, 16));
// calendar.toPrevMonth();
// calendar.toNextMonth();
// calendar.toNextYear();
// calendar.toPrevYear();
// calendar.changeLocale('en-US');
calendar.days[0].isWeekEnd() // 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