npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-pick-calendar

v1.3.3

Published

A scrollable calendar with no division into months for React App

Downloads

28

Readme

npm

react-pick-calendar

A scrollable calendar with no division into months for React App.

Allows you to select dates and view information about dates

install and import

Install by executing npm i react-pick-calendar

Import by adding import Calendar from 'react-pick-calendar';

Use by adding <Calendar/>

terms

fDate - date string in YYYY-MM-DD format

busy - busy day color (red)

pick - picked day color (green)

days - Object containing properties fDate and Any values

day becomes busy

daysOff - Array containing fDate

day becomes busy

daysPick - Array containing fDate

day becomes pick

Calendar object - Object, the expected properties: days, daysOff, daysPick

const calendarObject = {
    days: {
        fDate: Any,
        fDate: Any,
        ...
    },
    daysOff: [fDate, fDate, ...],
    daysPick: [fDate, fDate, ...]
};

props

| name | type | default | description | | ------------- | ----------- | ----------- | ----------- | | edit | bool | false | true allow to edit daysPick| | noOffset | bool | false | true cancel displaying the calendar from the first date in daysPick, if exist| | get | func | | Lazy loading async function that to receives a content from the backend. It gets the Date objects - start and end. Should return a Calendar object| | onChange | func | (daysPick, changedDays, pick) => {} | A function after daysPick handle change| | onDay | obj | {} | An object with functions that provide to each Day: onMouseOver, onContextMenu, onTouchHold. Each function receives Day's information and the Date object.| | maxPick | number | 366 | Maximum size of daysPick| | onError | func | | A function executing in any error case | | content | obj | | external Store| | setContent | func | | external Dispatch| | triggerGet | any | | Trigger starting Get-function hook| | triggerNew | any | | Trigger starting rerender hook| | startDate | str | | fDate, the calendar first date. Otherwise infinite scrolling to past| | endDate | str | | fDate, the calendar last date. Otherwise infinite scrolling to future|

onChange

A function that receives variables after every handle change daysPick:

  • daysPick: [fDate, fDate, ...] - new daysPick property of Calendar object
  • changedDays: [fDate, fDate, ...] - array of changed dates
  • pick: bool - if true, changed days became pick, if false - otherwise

onDay

An object with functions that provide to each Day:

  • onMouseOver
  • onContextMenu
  • onTouchHold (combine of touchEvents)

Each function receives variables from Day component:

  • DOM element
  • Day's information - value form calendarObject.days[fDate]
  • date: Date object
  • dayOff: bool - true if calendarObject.daysOff includes this Day

Only defined functions will be executed.

function yourFunction(element, info, date, dayOff) {
    // your code
};

const onDay = {
    onMouseOver: action,
    onContextMenu: action,
    onTouchHold: action
};

external Store

You can convert this component to uncontrolled and use any external store.

content - store with Calendar object where each Array replaced by Set:

const content = {
    days: {
        fDate: Any,
        fDate: Any,
        ...
    },
    daysOff: new Set([fDate, fDate, ...]),
    daysPick: new Set([fDate, fDate, ...])
};

If setContent is undefined, content is the initial state for internal storage

setContent - dispatch, that receives a function that convert previous content to new content. It is working like setState(prevState => {}) from React.useState hook.

Example with React.useState hook:

import React from "react";
import Calendar from 'react-pick-calendar';

function MyComponent() {
    const [state, setState] = React.useState({
        days: {},
        daysOff: new Set(),
        daysPick: new Set()
    });

    return (<Calendar content={state} setContent={setState} />);
}

Example with MobX:

import React from "react";
import ReactDOM from "react-dom";
import { makeAutoObservable } from "mobx";
import { observer } from "mobx-react-lite";
import Calendar from 'react-pick-calendar';

class Store {
    state = {
        days: {},
        daysOff: new Set(),
        daysPick: new Set()
    }

    constructor() {
        makeAutoObservable(this)
    }

    setState(func) {
        this.state = func(this.state)
    }
}

const calendarStore = new Store();
const CalendarView = observer(({ store }) => <Calendar content={store.state} setContent={(func) => store.setState(func)} />);
ReactDOM.render(<CalendarView store={calendarStore} />, document.getElementById('root');