Code Monkey home page Code Monkey logo

react-input-date-mask's Introduction

react-input-date-mask

At the moment, the project is not supported, I will only be glad if someone makes a fork and finalizes it

Input date masking component for React. React-input-date-mask requires React 16.8.0 or later.

Table of Contents

Install

npm install react-input-date-mask --save

Usage

import React from 'react';
import ReactInputDateMask from 'react-input-date-mask';

function DateInput(props) {
    return <ReactInputDateMask  mask='dd/mm/yyyy' showMaskOnFocus={true}  className={props.className} value={props.value} onChange={props.onChange} showMaskOnHover={true} />;
  
}

Properties

Name Type Default Description
mask {String} 'dd.mm.yyyy' Mask format
showMaskOnFocus {Boolean} false If this option - true, the mask will only be displayed when an event occurs onFocus
showMaskOnHover {Boolean} false If this option - true, when you mouse over the input, the mask appears, when you mouse leave the input, the mask disappears
className {String}
onChange {Function}
disabled {Boolean} false
readOnly {Boolean} false

mask

Mask format. Can be a string. There are two options. The first option by default: 'dd.mm.yyyy'. The second options: 'mm.dd.yyyy'. As a separator, you can use / or .

 <ReactInputDateMask mask='mm.dd.yyyy' or <ReactInputDateMask mask='dd.mm.yyyy'
 <ReactInputDateMask mask='mm/dd/yyyy' or <ReactInputDateMask mask='dd/mm/yyyy'

showMaskOnFocus

If this option - false, the mask will always be displayed. If this option - true, the mask will only be displayed when an event occurs onFocus

showMaskOnHover

This option is available when the option "showMaskOnFocus" - true. If this option - true, when you mouse over the input, the mask appears, when you mouse leave the input, the mask disappears

properties

You can also pass the following properties: className, disabled, readOnly, onChange

react-input-date-mask's People

Contributors

elter1109 avatar nickyoung87 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-input-date-mask's Issues

window is not defined

I started getting this error when I refresh the page:

image

image

This is a next implementation and this is when running locally (haven't tested in a production environment) and it only happens when I do a hard refresh of the page. If I navigate to the page it works fine.

Any thoughts on this?

Hooks are causing errors.

Installed and got an error when trying to use within JSX file.

Uncaught Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app
    See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    at resolveDispatcher (react.development.js:1438)
    at useState (react.development.js:1468)
    at b (ReactInputDateMask.js:167)
    at renderWithHooks (react-dom.development.js:14797)
    at mountIndeterminateComponent (react-dom.development.js:17409)
    at beginWork (react-dom.development.js:18489)
    at HTMLUnknownElement.callCallback (react-dom.development.js:189)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:238)
    at invokeGuardedCallback (react-dom.development.js:291)
    at beginWork$1 (react-dom.development.js:23055)
    at performUnitOfWork (react-dom.development.js:22019)
    at workLoopSync (react-dom.development.js:21995)
    at performSyncWorkOnRoot (react-dom.development.js:21613)
    at react-dom.development.js:11131
    at unstable_runWithPriority (scheduler.development.js:659)
    at runWithPriority$1 (react-dom.development.js:11077)
    at flushSyncCallbackQueueImpl (react-dom.development.js:11126)
    at workLoop (scheduler.development.js:603)
    at flushWork (scheduler.development.js:559)
    at MessagePort.performWorkUntilDeadline (scheduler.development.js:162)

autoFocus don't work

The option autoFocus don't work.

How to make the focus stay on the component when loading the screen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.