André
André

Reputation: 33

How can i change the language of an react-date-range DefinedRange?

I've created a project that use a react-date-range component and i need to change the default language to PT.

DateRangePicker is in Portuguese but the DefinedRange in English and i need it in PT.

At this moment I've tried: import pt from 'date-fns/locale/pt'; and

<DateRangePicker
  locale={pt}
  onChange={item => setRange([item.selection])}
  editableDateInputs={true}
  moveRangeOnFirstSelection={false}
  ranges={range}
  months={1}
  direction="horizontal"
/>

Upvotes: 0

Views: 1626

Answers (1)

Tales Felix
Tales Felix

Reputation: 1

import { ptBR } from 'date-fns/locale'

locale={ptBR}

Upvotes: 0

Related Questions