1.0.33 • Published 6 years ago

material-ui-custom-datepicker v1.0.33

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

material-ui-custom-datepicker

Custom DatePicker component, that includes connected material-ui DatePicker and TextField components. react-input-mask is used for cutting useless symbols. There is common presence, max value, min value and date format validation.

Installing

npm install material-ui-custom-datepicker

Usage

import React from "react";
import {DatePicker} from "material-ui-custom-datepicker";


class myDatePicker extends React.Component{
  constructor(props) {
    super(props);
    this.state = {
      value: new Date()
    }
  }  
  
  handleChange = (event, value) => {
    this.setState({value});
  }
    
  render(){
    return (
      <DatePicker
        name="birthDate"
        value={this.state.value}
        onChange={this.handleChange}  
        floatingLabelText="Birthday"
        autoOk
        cancelLabel="Back"
        minDate={new Date(1900, 0, 1)}
        maxDate={new Date(2100, 0, 1)}
      />
    );
  }
}

Component support all default DatePicker and TextField material-ui properties. Additional ones are:

  • invalidDateError - invalid date format error
  • maxDateError - "too late date" error
  • minDateError - "too early date" error
  • dateInputFormat - date format in TextField
  • dateValueFormat - date value format
  • maskChar - maskChar of react-input-mask
  • mask - mask of react-input-mask

In max and min date errors max and min values are inserting instead of "{date}".

1.0.33

6 years ago

1.0.32

6 years ago

1.0.31

6 years ago

1.0.30

6 years ago

1.0.29

6 years ago

1.0.28

6 years ago

1.0.27

6 years ago

1.0.26

6 years ago

1.0.25

7 years ago

1.0.24

7 years ago

1.0.23

7 years ago

1.0.22

7 years ago

1.0.21

7 years ago

1.0.20

7 years ago

1.0.19

7 years ago

1.0.18

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago