preact-calendar

1.2.0 • Public • Published

preact-calendar

Installation

npm install preact-calendar -S

This is how it looks

Screenshot

Usage

Code Example:

import Calendar from "preact-calendar";
 
function onDateSelect(date) {
  console.log("You clicked: ", date);
}
 
render(
  <Calendar minDate={new Date('2019-01-01')} disablePast={true} onSelect={this.getSelectedDate()} highlightSecondFourthSatdays={true}
    highlightSundays={true} highlightToday={true}/>,
  document.body
);

(Do not forget to give proportionate height and width to parent element)

Options

Properties used to customise the rendering:

Name Type Description
minDate Date The date from which to start the Calendar
disablePast Boolean When true, disables the selection of dates before Today
onSelect function Callback function, called on selecting a date
highlightSundays Boolean When true, highlights all Sundays with red color (defaults: false)
highlightToday Boolean When true, today's date is highlighted by default (defaults: false)
highlightSecondFourthSatdays Boolean When true, highlights second & fourth Saturday in each month (defaults: false)

Package Sidebar

Install

npm i preact-calendar

Weekly Downloads

0

Version

1.2.0

License

MIT

Unpacked Size

28.8 kB

Total Files

5

Last publish

Collaborators

  • sahilkul95