1.2.5 • Published 2 years ago
datepicker-library-oc v1.2.5
datepicker-library-oc
A simple datepicker made with React
Install
npm install --save datepicker-library-oc
Usage
All available props are shown in the next section. To get a selected date's value, you need a function that will return it, or put it in your state. You can then call that function in the onChange prop.
import React, { Component } from "react";
import DatePicker from "datepicker-library-oc";
import "datepicker-library-oc/dist/index.css";
function Example() {
const [date, setDate] = useState("");
const handleChange = (selectedDate) => {
setDate(selectedDate);
};
return <DatePicker onChange={handleChange} />;
}
Props
Prop | Type | Default value |
---|---|---|
onChange | Function | Return null. Should be present in every datepicker component with a function as a value |
inputIcon | Boolean | false |
closeButton | Boolean | true |
highlightToday | Boolean | true |
lang | String | "en" (also available for now : "fr") |
startYear | Number | null (or current year) |
startMonth | Number | null (or current month index). The month index goes from 0 (january) to 11 (december). |
Examples
All examples can be found on https://louannem.github.io/datepicker-library-oc/
License
MIT © louannem