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

react-ranged-datepicker

v1.0.7

Published

React Ranged Datepicker effortlessly select date ranges in your React applications with our intuitive Date Range Picker component. Designed for simplicity and versatility, this picker allows users to specify start and end dates seamlessly. Raise a PR or i

Downloads

10

Readme

DateRangePicker Component

DateRangePicker is a React component that provides a user-friendly interface for selecting date ranges within specified minimum and maximum date boundaries.

Installation

To install DateRangePicker in your project, you can use npm or yarn:

npm install react-ranged-datepicker

or

yarn add react-ranged-datepicker

Usage

Import the DateRangePicker component into your React application and use it as follows:

import React, { useState } from "react";
import { DateRangePicker } from "react-ranged-datepicker";
import "./App.css";

const App = () => {
  const minDate = new Date(2023, 11, 1); // January 1, 2023
  const maxDate = new Date(2029, 1, 2); // February 2, 2024
  const initialStartDate = new Date(2025, 6, 14); // May 14, 2023

  const [selectedDates, setSelectedDates] = useState({
    startDate: null,
    endDate: null,
  });

  const handleDateChange = ({ startDate, endDate }) => {
    setSelectedDates({ startDate, endDate });
  };

  return (
    <div className="app">
      <h1>Date Range Picker</h1>
      <DateRangePicker
        minDate={minDate}
        maxDate={maxDate}
        startDate={initialStartDate}
        onDateChange={handleDateChange}
      />
      <div>
        <p>
          Selected Start Date:{" "}
          {selectedDates.startDate
            ? selectedDates.startDate.toDateString()
            : "None"}
        </p>
        <p>
          Selected End Date:{" "}
          {selectedDates.endDate
            ? selectedDates.endDate.toDateString()
            : "None"}
        </p>
      </div>
    </div>
  );
};

export default App;

Props

  • minDate (Date): The minimum selectable date. If not provided, defaults to January 1, 1000.
  • maxDate (Date): The maximum selectable date. If not provided, defaults to December 31, 9999.
  • startDate (Date): The initial start date of the date range. If not provided, defaults to today's date or minDate if today's date is not within the specified range.
  • theme (String): The theme of the DateRangePicker. Available themes: "light-theme" (default) and "dark-theme".
  • onDateChange (Function): A callback function that is called when the selected date range changes. It receives an object containing the new start and end dates.

Prop Details

  • minDate and maxDate: These props define the boundaries within which dates can be selected. Any date before minDate or after maxDate will be disabled.
  • startDate: This prop sets the initial start date of the date range. If not provided, the component will use today's date if it falls within the range specified by minDate and maxDate, otherwise, it will default to minDate.
  • theme: This prop allows you to customize the appearance of the DateRangePicker. You can choose between "light-theme" (default) and "dark-theme".
  • onDateChange: This prop enables you to handle changes in the selected date range. The callback function receives an object containing the new start and end dates whenever the user interacts with the date picker.

Features

  • Select start and end dates for a date range.
  • Navigate through months and years to select dates within the specified range.
  • Customizable themes to match your application's style.

License

This project is licensed under the MIT License - see the LICENSE file for details.