0.2.3 • Published 6 months ago

datipi-react v0.2.3

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

datipiReact

datipiReact is a JavaScript library that provides a React-friendly wrapper for the jQuery DateTimePicker.


Installation

You can install datipiReact using npm or yarn:

npm install datipi-react --save

or

yarn add datipi-react

Usage

To use datipiReact in your React project, follow these steps:

Import the DateTimePicker component at the top of your JavaScript/TypeScript file:

import * as datipiReact from 'datipi-react';

Use useEffect to call initDateTimePicker with the target DOM element and any options you wish to pass to the DateTimePicker, and return a cleanup function to call destroyDateTimePicker when the component unmounts.

  /**
   * A hook that initializes DateTimePickers when the component mounts
   * and destroys them when the component unmounts.
   */
  useEffect(() => {
    datipiReact.initDateTimePicker(
      '#date-of-birth',
      {
        format: 'Y-m-d'
      },
      setDateOfBirth);

    datipiReact.initDateTimePicker(
      '#start-date',
      {
        format: 'Y-m-d'
      },
      setStartDate);

    return () => {
      datipiReact.destroyDateTimePicker('#date-of-birth');
      datipiReact.destroyDateTimePicker('#start-date');
    };
  }, []);

License

This library is licensed under the MIT License. See the LICENSE file for details.

0.2.3

6 months ago

0.2.2

6 months ago

0.2.1

6 months ago

0.2.0

6 months ago

0.1.0

6 months ago

0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago