React-datepicker: Mask typed input

Created on 21 Sep 2016  路  11Comments  路  Source: Hacker0x01/react-datepicker

Mask user input on keyUp event. Ex.: --/--/----

enhancement

Most helpful comment

yes it's very easy
<DatePicker {...DatePickerProps} customInput={<MaskedInput mask={['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]} } />

All 11 comments

Any solution for this one?

@ReactGirl I'm not found solution, using that component, but I use air-datepicker for that feature

any update on this ?

@alyahmedaly I heard so that component have possible to connect with react-inputmask

yes it's very easy
<DatePicker {...DatePickerProps} customInput={<MaskedInput mask={['(', /[1-9]/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]} } />

I think that issue need to close

Agreed, I don't think this is something that we could easily support natively given the flexibility of the date formats.

@alyahmedaly Where can I find the 'DatePickerProps'? I'm trying to use the 'MaskedInput' lib, but the value doesn't change when I select a new date on the calendar.

@vctormb not sure what's your issue but any way this my props
const DatePickerProps = { onBlur: input.onBlur, onFocus: input.onFocus, dateFormat: dateFormat, selected: selectedValue, onChange: this.handleChange, className: "form-control", fixedHeight: true, showMonthDropdown: true, showYearDropdown: true, placeholderText: custom.placeholder, disabled: custom.disabled, minDate: custom.min, maxDate: custom.max, customInput: <DatePickerMaskedInput />, customInputRef: 'inputRef' };

@alyahmedaly When I select a new date on the Calendar it does not change the MaskedInput value. Do you know how to solve it?

New soluction ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jjjss94 picture jjjss94  路  3Comments

jcabrerazuniga picture jcabrerazuniga  路  3Comments

sarav1234 picture sarav1234  路  3Comments

ericreis picture ericreis  路  3Comments

arturictus picture arturictus  路  3Comments