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

cm-caesar

v1.1.7

Published

Caesar Calendar Library

Readme

Caesar

React Calendar library with a similar API to react-dates.

Several bugs and performance issues within react-dates related to unnecessary re-renders motivated me to create my own library that avoided these hiccups. Uses date-fns internally rather than moment saving over 400 KB. Has a similar API which allows for an easy transition.

Installation

To install, you can use npm or yarn:

$ npm install cm-caesar
$ yarn add cm-caesar

Examples

Minimum:

This will render a calendar component which allows you to select a date range, defaults to the current month, and shows a single month. This doesn't really do much as you'll need a way to hook into date changes.

import React from 'react'
import Caesar from 'cm-caesar'

export default React.PureComponent {
    render() {
        return <Caesar />
    }
}  

Handled State:

This will render the same calendar as the Minimum Example, but allows you to access the current startDate & endDate from outside of the Caesar component.

import React from 'react'
import Caesar from 'cm-caesar'

export default React.Component {
    state = {
        startDate: null,
        endDate: null,
    }
    
    handleChange = ({ startDate, endDate }) => {
        this.setState({ startDate, endDate })
    }
    
    render() {
        return (
            <Caesar
                onDateChange={this.handleChange}
            />
        )
    }
}

Custom Day Component:

Sometimes you need to display days on the calendar differently and/or include more information. The renderDayContents props allows you to easily do so. The example below uses the format method exported by date-fns to display days of the month with an alternate format.

import React from 'react'
import Caesar from 'cm-caesar'
import { format } from 'date-fns'

export default React.PureComponent {
    renderDay = (day) => (
        <div>
            {format(day, 'Do')}
        </div>
    )

    render() {
        return (
            <Caesar
                renderDayContents={this.renderDay}
            />
        )
    }
}

Props

| Name | Type | Default | Description | | ----------------- | ---------------------------------------------- | ------------ | ------------------------------------------------------------ | | start | Date | new Date() | Month to start the calendar on. | | numberOfNights | number | 1 | Number of months to display at once. Also dictates number of months added when adding more months. | | onDateChange | ({ startDate: ?Date, endDate: ?Date }) => void | undefined | Triggered any time a date is changed. Allows access to dates on change. | | hideDaysOfWeek | Boolean | false | Hide days of the week. Useful for advanced functionality and styling. | | onAddPage | (nextMonth: Date) => void | undefined | Triggered any time a new page of months is added. Returns the first day of the next page of months. | | onFocusChange | (focused: string) => void | undefined | Triggered any time the focus changes. Returns a string which can be be one of these values: 'startDate' & 'endDate' depending on which date was selected last. | | renderDayContents | (day: Date) => React.Node | undefined | Allows you to render a custom day component. Gives you access to the current day and requires that you return a valid React.Node. |

License

cm-caesar is released under the MIT license.