0

I want to disable dates before today and using a input html "datepicker" in React, how can I make this possible?

          <div className="form-group">
                <label className="label" htmlFor="date" >Date</label>
                <Input
                    className="form-control" id="date"
                    type="date"
                    name="date"
                    value={user.date}
                    onChange={(e) => handleUser(e)}
                    required
                />
            </div>

This is what I want to achieve

DevJazz
  • 71
  • 6
  • Surely looks like you use a package, in that case mention the package name and go through the docs, this functionality is very common for datepickers – Anurag Srivastava Oct 29 '20 at 09:37
  • It' not a package, it the default date form html that I use. I found this: http://jsfiddle.net/tj9Xh/2/ , but I don't know how to implement this to react. – DevJazz Oct 29 '20 at 11:07
  • You can add a `min` attribute. Check out answers in the duplicate – Anurag Srivastava Oct 29 '20 at 15:36
  • Does this answer your question? [How do I restrict past dates in html5 input type Date](https://stackoverflow.com/questions/43274559/how-do-i-restrict-past-dates-in-html5-input-type-date) – Anurag Srivastava Oct 29 '20 at 15:36

0 Answers0