Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a requirement to display start and end-date in material UI. The end-date field must not allow users to select before dates from selected start-date. I am using text field type date material UI, but is not working. please help

<TextField 
    type="date"
    defaultValue={moment().format("yyyy-mm-dd")}  
    onChange={endDate}
    InputProps={{
       min: "2020-01-04",
    }}
/>      
question from:https://stackoverflow.com/questions/65602812/textfield-type-date-in-react

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
101 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try the following code snippet. It should do the trick.

<TextField
  InputProps={{inputProps: { min: "2020-05-01", max: "2020-05-04"} }}
/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...