1.1.5 • Published 5 months ago

@gavrochewy/react-ocgw-datepicker v1.1.5

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

NodeJS - React - JavaScript - CSS

Here's a lightweight datepicker plugin with a modern, universal design to integrate into any of your applications!

Prerequisites

Getting started

Installation

npm install @gavrochewy/react-ocgw-datepicker

Basic usage

import { Datepicker } from "@gavrochewy/react-ocgw-datepicker";

const YourComponent = () => {

  return (
        <Datepicker />;
    )

};

The "Datepicker" component works without any default properties. If you simply specify <Datepicker />, an input will appear on your page and the datepicker will appear when the input is clicked. To retrieve the value returned by the Datepicker, use the callback property and specify the callback function you wish to associate with the Datepicker.

const YourComponent = () => {

    const [myDate, setMyDate] = useState()

    return (
        <Datepicker callback={setMyDate(date)} />;
    )

};

Advanced usage

If you wish to restrict the user with a maximum or minimum date, customize the datepicker activation input or set a specific default date, you can do so using the component's advanced properties.

Initial date

Set an initial date with the initialDate property, which will be displayed by default in the input and when Datepicker is opened. If you don't set an initialDate property in your component, the current date will be used. The initialDate property must be a Date object.

<Datepicker initialDate={new Date(2000-01-01)} />

Minimum date

The minDate property is optional and allows you to define a minimum date not to be exceeded when selecting in Datepicker. By specifying this value, you prevent the selection of dates prior to the one you have defined, thus ensuring that your selections remain in line with your time criteria. The minDate property must be a Date object.

<Datepicker minDate={new Date()} />

Maximum date

The maxDate property is an optional feature that allows you to define a maximum date for the selection in Datepicker. By specifying this value, you avoid the possibility of selecting dates later than the one you've defined, thus ensuring that your selections remain within the time limits you've set. The maxDate property must be a Date object.

<Datepicker maxDate={new Date(2030-01-01)} />

Input CSS classes

With the `inputClasses property, you can define which CSS classes you want to use for the date selection input. Indicate the classes you wish to use in a single line in this form:

<Datepicker inputClasses={"my-class another-class"} />

Thank you for choosing my Datepicker plugin!

Gavroche Woerly

1.1.1

5 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

5 months ago

1.1.2

5 months ago

1.1.0

5 months ago

1.0.22

5 months ago

1.0.21

5 months ago

1.0.26

5 months ago

1.0.25

5 months ago

1.0.24

5 months ago

1.0.23

5 months ago

1.0.29

5 months ago

1.0.28

5 months ago

1.0.27

5 months ago

1.0.30

5 months ago

1.0.19

5 months ago

1.0.18

5 months ago

1.0.17

5 months ago

1.0.16

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.20

5 months ago

1.0.11

5 months ago

1.0.10

5 months ago

1.0.15

5 months ago

1.0.14

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago

0.0.3

7 months ago

0.0.2

7 months ago

0.0.1

7 months ago