1.0.11 • Published 2 years ago

react-onchange-date-formatter v1.0.11

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years 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

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago