1.0.11 • Published 11 months ago

react-onchange-date-formatter v1.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
11 months ago

��# react-onchange-date-formatter

A simple date formatter for react apps

installation

npm i react-onchange-date-formatter

props

  • e: Event on onChange.
  • setState: State updater.
  • specialCharacter: Any special character that you want to format the date.

Usage Example

import React, { useState } from "react";
import useFormatDate from "react-onchange-date-formatter";

export default function App() {
    const [date, setDate] = useState("");

    const formatDate = useFormatDate();

    // This can be "-", "/", " ", ".", "|" etc
    const specialCharacter = "/";

    const handleDateChange = (e) => {
        formatDate(e, setDate, specialCharacter);
    };

    return (
        <div>
            <input
                type="text"
                placeholder="10/10/2023"
                value={date}
                onChange={handleDateChange}
            />
        </div>
    );
}

npm link

https://www.npmjs.com/package/react-onchange-date-formatter

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago