Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/react-date-range

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-date-range

TypeScript definitions for react-date-range

  • 1.4.9
  • ts4.6
  • ts4.7
  • ts4.8
  • ts4.9
  • ts5.0
  • ts5.1
  • ts5.2
  • ts5.3
  • ts5.4
  • ts5.5
  • ts5.6
  • ts5.7
  • ts5.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/react-date-range?

@types/react-date-range provides TypeScript definitions for the react-date-range library, which is a React component for selecting date ranges. It helps developers use the library with TypeScript by providing type definitions for the various components and props.

What are @types/react-date-range's main functionalities?

Date Range Picker

The Date Range Picker allows users to select a range of dates. The code sample demonstrates how to import and use the DateRangePicker component, set an initial date range, and handle date selection changes.

import { DateRangePicker } from 'react-date-range';
import { addDays } from 'date-fns';

const selectionRange = {
  startDate: new Date(),
  endDate: addDays(new Date(), 7),
  key: 'selection'
};

<DateRangePicker
  ranges={[selectionRange]}
  onChange={handleSelect}
/>;

Single Date Picker

The Single Date Picker allows users to select a single date. The code sample shows how to import and use the Calendar component, set an initial date, and handle date selection changes.

import { Calendar } from 'react-date-range';

const handleSelect = (date) => {
  console.log(date);
};

<Calendar
  date={new Date()}
  onChange={handleSelect}
/>;

Defined Ranges

Defined Ranges allow users to quickly select predefined date ranges. The code sample demonstrates how to set up and use defined ranges with the DateRangePicker component.

import { DateRangePicker } from 'react-date-range';
import { addDays } from 'date-fns';

const definedRanges = [
  {
    label: 'Today',
    startDate: new Date(),
    endDate: new Date()
  },
  {
    label: 'Last 7 Days',
    startDate: addDays(new Date(), -7),
    endDate: new Date()
  }
];

<DateRangePicker
  ranges={definedRanges}
  onChange={handleSelect}
/>;

Other packages similar to @types/react-date-range

FAQs

Package last updated on 05 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc