Search code examples
javascriptreactjsbootstrap-4calendarreactstrap

Min and Max value Reactstrap Input Type Date (Calendar)


I'm trying to add a Calendar to my website that makes an appoinment and I need to make it, obviously, from today to the future. How can I do that with the Reactstrap component? Can't find on docs.

Importing the Calendar:

import { Input } from "reactstrap";

    <Input
      type="time"
      className="form-control"
      id="time-start-input"
      value={startTime}
      onChange={(e) => {
        setTime(e.target.value);
      }}
    />

How can I put a minValue to receive dates just after that date? For example:

minValue={today}

And then, disable the past.


Solution

  • Regarding the doc of Reactstrap Datepicker, you can use the minDate : https://reactstrap-date-picker.afialapis.com/#mindate

    <FormGroup>
            <Label>My Date Picker</Label>
            <DatePicker 
               id      = "example-datepicker" 
               minDate={"2016-05-19T12:00:00.000Z"}
            <FormText>Help</FormText>
     </FormGroup>