React-native-calendars: Disable Previous/Past dates

Created on 29 Aug 2017  路  3Comments  路  Source: wix/react-native-calendars

I just want to disable the previous/past dates. I have gone through the doc but ihave not seen any option to disable Past/Previous dates dates

Most helpful comment

Firstly get today's date by,
````
import moment from 'moment';
..
class Mycal extends component
{..
const today = moment().format("YYYY-MM-DD");
..
}

Within Component Calendar you can add minDate prop as,
     ```
<Calendar
      ..
      minDate={today}
      />      

All 3 comments

Firstly get today's date by,
````
import moment from 'moment';
..
class Mycal extends component
{..
const today = moment().format("YYYY-MM-DD");
..
}

Within Component Calendar you can add minDate prop as,
     ```
<Calendar
      ..
      minDate={today}
      />      

Yes, use the minDate property.

@anishtr4 - It's Not working I Wonder why people tell its working...
image

Below the code :
render() {
const today = moment().format("DD-MM-YYYY");



onClick={this.dateSelect}
id="datePicker"
type="date"
name="startDate"
className={form-control ${ formErrors.startDate ? "is-invalid" : "" }}
required
pattern="\d{2}-\d{2}-\d{4}"
minDate={today}
max="2020-12-31"
onKeyPress={this.deTyped}
onChange={this.handleChange}
value={formValues.startDate}
/>
{formErrors.startDate}


}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dobiedad picture dobiedad  路  4Comments

idlework picture idlework  路  4Comments

microwin168 picture microwin168  路  4Comments

joaosauer picture joaosauer  路  4Comments

nickitatkach picture nickitatkach  路  4Comments