Comments (3)
Thank you.
You pass the phrases as an object. DayLabelFormat, weekdayLabelFormat, and monthLabelForm, these are functions (callbacks) that take a date as an argument and return a string - formatted label. Below is an example with date-fns, but you can also use a moment or you can format labels by yourself.
Here is an example:`
import {es as locale} from 'date-fns/locale'
import {format} from 'date-fns'
function Test() {
return (
<DateRangeInput
...otherProps,
displayFormat={displayFormat}
phrases={{
datepickerStartDatePlaceholder: 'Seleccionar',
datepickerStartDateLabel: 'Fecha de inicio:',
datepickerEndDatePlaceholder: 'Seleccionar',
datepickerEndDateLabel: 'Fecha de inicio:',
resetDates: 'Deshacer',
startDateAriaLabel: 'Fecha de inicio',
endDateAriaLabel: 'Fecha de inicio',
startDatePlaceholder: 'Fecha de inicio',
endDatePlaceholder: 'Fecha de inicio',
close: 'Cerca',
}}
displayFormat={text('displayFormat', 'MM/dd/yyyy')}
dayLabelFormat={(date: Date) => format(date, 'dd', {locale})}
weekdayLabelFormat={(date: Date) => format(date, 'eeeeee', {locale})}
monthLabelFormat={(date: Date) => format(date, 'MMMM yyyy', {locale})}
/>
)
}
Here is a list of all possible phrases click
from react-datepicker.
Thank you so much :) This worked for me. I guess my problem was more with how date-fns handles localization and less about this library after all.
Are you interested in a pull request which takes your answer and maybe a link and small explanation of a date-fns example to extend the Readme?
from react-datepicker.
Yes, of course.
from react-datepicker.
Related Issues (20)
- pass readonly as props for startDate and endDate input
- dayHoverRangeBorderColor not used in Day styles
- Is there any way to specify month days?
- DateSingleInput - onFocusChange prop. Issue with invalid characters displaying to user. Date validation.
- System Accepts 00 as entry field when user keys in date.
- [DateRangeInput] Multiple active range dates HOT 3
- Is there any way to create a border radius effect on the input?? HOT 2
- Wrong Typescript type annotations HOT 1
- Request to add onNextMonthClick and onPrevMonthClick HOT 1
- Close button modification
- TabIndex return -1
- Support react 18
- Problem with arrow keys on latest version
- initialVisibleMonth ignored when startDate and endDate are set
- Prevent to hide datepicker when clicking anywhere, but close it when clicking close button
- Prevent to hide datepicker HOT 1
- Input losing focus when I used arrows in datepicker HOT 8
- Is Possible create isStartDate and isEndDate? HOT 1
- React native HOT 1
- No event triggered when typing non-date-related input HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-datepicker.