React-datepicker: Change locale doesn't work on datepicker custom input

Created on 20 May 2019  路  2Comments  路  Source: Hacker0x01/react-datepicker

Expected behavior

Allow use of other date and hour format e.g (dd/MM/yyyy : HH:mm) through locale 'pt-br'. This problem affect inputs on our application.

Actual behavior

The format(date/hour) continue uses the default format. And shows the warn on console:
A locale object was not found for the provided string ["pt-br"].

Steps to reproduce

The code is some like this:

  import DatePicker from 'react-datepicker'
  import 'react-datepicker/dist/react-datepicker.css'
  import 'moment/locale/pt-br'

    <DatePicker
        { ...props }
        locale='pt-br'
     />

I have try fix it with different forms in last days, but the behaviour does not change.

wontfix

All 2 comments

Try adding the dateFormat="PP" or any of the various P format string options from https://date-fns.org/v2.0.0-beta.2/docs/format:

<DatePicker
     { ...props }
     locale='pt-br'
     dateFormat="PP"
/>

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lclemence picture lclemence  路  3Comments

ro-savage picture ro-savage  路  3Comments

hoodsy picture hoodsy  路  3Comments

arturictus picture arturictus  路  3Comments

jjjss94 picture jjjss94  路  3Comments