Socket
Socket
Sign inDemoInstall

@meinefinsternis/react-horizontal-date-picker

Package Overview
Dependencies
10
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @meinefinsternis/react-horizontal-date-picker

A simple component that allows the user to choose a date from a scrollable monthly view.


Version published
Maintainers
1
Install size
6.82 MB
Created

Readme

Source

alt text

Installation

The package can be installed via npm:

npm install @meinefinsternis/react-horizontal-date-picker --save

Below is a simple example of how to use the Datepicker in a React view.

import React from "react";
import { Datepicker, DatepickerEvent} from "@meinefinsternis/react-horizontal-date-picker";
import { enUS } from "date-fns/locale";

const Example = () => {
  const [date, setDate] = React.useState<{
    endValue: Date | null;
    startValue: Date | null;
    rangeDates: Date[] | null;
  }>({
    startValue: null,
    endValue: null,
    rangeDates: [],
  });

  const handleChange = (d: DatepickerEvent) => {
    const [startValue, endValue, rangeDates] = d;
    setDate((prev) => ({ ...prev, endValue, startValue, rangeDates }));
  };

  return (
    <Datepicker
      onChange={handleChange}
      locale={enUS}
      startValue={date.startValue}
      endValue={date.endValue}
    />
  );
};

Props

Common props you may want to specify include:

  • locale: Locale - locales directly exported from date-fns/locales.
  • onChange: (d: [Date | null, Date | null, Date[] | null]) => void - subscribe to change events
  • startValue: Date | null - defines the initial start value
  • endValue: Date | null - defines the initial end value
  • startDate?: Date - defines minimum date. Default new Date().
  • endDate?: Date - defines maximum date. Default new Date() + 3 months
  • className?: object - apply a className to the customize
  • disabledDates?: Date[] - list of disabled dates

Keywords

FAQs

Last updated on 30 Sep 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc