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 🙏

© 2024 – Pkg Stats / Ryan Hefner

input-date-calendar

v0.0.9

Published

React component to render a simple calendar.

Downloads

3

Readme

Input Date Calendar

React component to render a simple calendar.

This project is integrated with simple-date, a light date component.

Install

npm install wviveiro/input-date-calendar

Usage

import InputDateCalendar from 'input-date-calendar';
import 'input-date-calendar/dist/styles/index.css';

const Form = () => {
    const [date, setDate] = useState('');

    // onChange receives a simple-date object
    const onChange = (dt) => setDate(dt);

    // isDateDisabled receives a simple-date object and
    // expects a boolean return
    const isDateDisabled = (dt) => {
        return (dt.getFullDate() === '2019-07-10'); // Block only 2019-07-10
    }


    return (
        <div>
            <InputDateCalendar
                date={date}
                format="DD/MM/YYYY"
                placeholder="Change date"
                className="calendar-wrapper"
                inputClassName="input-calendar"
                onChange={onChange}
                isDateDisabled={isDateDisabled}
                disabled={false}
            />
        </div>
    );
}

Props

  1. format: string - Date format that will be displayed and also that will be received from date prop. Default YYYY-MM-DD

  2. date: string - Date that will show in the input field. The date has to be in the same format of the prop format

  3. placeholder: string - Placeholder of the input field

  4. className: string - appends a class in the main wrapper div of the component

  5. inputClassName: string - appends a class in the input field for the component

  6. onChange: function - Triggers on changing date. The return is a date string in the same format as the prop format.

  7. isDateDisabled: function - Verifies if a specific date is disabled and don't let the customer select it.

  8. disabled: boolean - Disable changing field.

Languages

The component is available in english and portuguese. The default language is english. To use portuguese just load

import InputDateCalendar from 'input-date-calendar/dist/portuguese';
import 'input-date-calendar/dist/styles/index.css';

Extending other languages:

import generateCalendar from 'input-date-calendar/dist/calendar';

const InputDateCalendar = generateCalendar({
    months: ['', 'Jan' ... 'Dec'],
    weekdays: ['', 'Mon' ... 'Sun'],
    btnfinish: 'DONE',
    hasErrorButton: 'INVALID DATE',
});