Tcomb-form-native: [IOS datePicker] - minDate and maxDate support?

Created on 26 Dec 2016  路  4Comments  路  Source: gcanti/tcomb-form-native

Version

Hi i am using latest versions of both react-native and tcomb-form-native.

minDate and maxDate options does not works for ios datepicker.

Most helpful comment

@ngnclht1102 reason of problem is moment(new Date()).When you use moment(new Date()),it returns object.But maximumDate only accept Date as type of value.As a result of you should convert moment() object to Date type with toDate() method.Here is right:

{
     stylesheet: styles.datePickerStyles,
     config: {
         format: (value) => moment(value).format("MM/DD/YYYY"),
     },
     mode: "date",
     maximumDate:moment(new Date()).toDate()
}

All 4 comments

it seems this options are set as maximumDate and minimumDate as prop.They are not set in config object like android.

```
{
stylesheet: styles.datePickerStyles,
config: {
format: (value) => moment(value).format("MM/DD/YYYY"),
},
mode: "date",
maximumDate:moment(new Date())
}

@semirturgay I have the same problem, could you tell me how can you solve that?

@ngnclht1102 reason of problem is moment(new Date()).When you use moment(new Date()),it returns object.But maximumDate only accept Date as type of value.As a result of you should convert moment() object to Date type with toDate() method.Here is right:

{
     stylesheet: styles.datePickerStyles,
     config: {
         format: (value) => moment(value).format("MM/DD/YYYY"),
     },
     mode: "date",
     maximumDate:moment(new Date()).toDate()
}

@yasemincidem Thanks, I got it. It worked!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sibelius picture sibelius  路  5Comments

scarlac picture scarlac  路  4Comments

BogdanHossu picture BogdanHossu  路  6Comments

casoetan picture casoetan  路  5Comments

chauthai picture chauthai  路  4Comments