React-dates: display format issues??????????

Created on 20 Sep 2018  路  4Comments  路  Source: airbnb/react-dates

this displayFormat:() =>moment.localeData().longDateFormat('L') ==> "MM/DD/YYYY"

but i need this format "DD/MM/YYYY" ??? so what is the code
i am give input as DD-MM-YYYY ex.. 13-09-2018 but calendar showing invalid date so i am trying to date display format

Most helpful comment

You should pass in:

displayFormat={() => "DD/MM/YYYY"}

Although your statement isn't terribly clear. What do you mean by:

i am give input as DD-MM-YYYY ex.. 13-09-2018 but calendar showing invalid date so i am trying to date display format

If you pass in a DD-MM-YYYY format date, that will be invalid unless you use that format.

All 4 comments

You should pass in:

displayFormat={() => "DD/MM/YYYY"}

Although your statement isn't terribly clear. What do you mean by:

i am give input as DD-MM-YYYY ex.. 13-09-2018 but calendar showing invalid date so i am trying to date display format

If you pass in a DD-MM-YYYY format date, that will be invalid unless you use that format.

is there any inputFormat attribute in this lib?

It's the displayFormat? That's what controls the allowed input format as well as what's actually displayed.

Can I set the format this way:
displayFormat={() => ["DD","MM","YYYY"]}

So that I have access to state props by an array

Was this page helpful?
0 / 5 - 0 ratings