New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

reactjs-calendar-date-picker

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reactjs-calendar-date-picker

A date picker calendar component built with react that supports date selection and reserved days.

  • 0.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

React Calendar Date Picker

A date picker calendar component built with react that supports date selection and reserved days.

alt text

Installation

 npm install reactjs-calendar-date-picker
import Calendar, { TCalDate } from "reactjs-calendar-date-picker";

You need to import the css style

import "reactjs-calendar-date-picker/dist/style.css";

Examples

import { useState } from "react";
import Calendar, { TCalDate } from "reactjs-calendar-date-picker";
import "reactjs-calendar-date-picker/dist/style.css";

const App = () => {
  const [selected, setSelected] = useState();

  const onChange = (arg) => {
    const { from, to } = arg;

    const fromDate = new Date(from).toLocaleDateString();
    const toDate = to ? new Date(to).toLocaleDateString() : "";

    setSelected({ fromDate, toDate });
  };

  // convert dates: new Date().getTime() -> 1691526600000
  const sample_days = [1691526600000, 1691699400000];

  const { fromDate, toDate } = selected || {};

  return (
    <div className="container">
      <Calendar reservedDays={sample_days} onChange={onChange} />
      <p className="note">
        {fromDate && toDate && (
          <>
            <span>from: {fromDate}</span>
            <span>to: {toDate}</span>
          </>
        )}
      </p>
    </div>
  );
};

export default App;

Keywords

FAQs

Package last updated on 22 Sep 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