Skip to content
Discussion options

You must be logged in to vote

Hi @joaopedrodcf, I didn't know about that setDefaultOptions in date-fns. It doesn't seem to have effect to DayPicker: https://codesandbox.io/s/polished-bash-4sp2p6?file=/src/App.tsx

As alternative you can import a wrapper where you set these props once for all:

// ./example/DayPickerEs.tsx

import {
  DayPicker as DayPickerDefault,
  DayPickerProps
} from "react-day-picker";

/** Render DayPicker with Spanish locale */
export function DayPicker(props: Omit<DayPickerProps, "locale">) {
  return <DayPickerDefault {...props} locale={es} />;
}

Then in your app you import from DayPickerEs.tsx to get a DayPicker with the same locale:

import { DayPicker } from './DayPickerEs.tsx';

Would this so…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@joaopedrodcf
Comment options

@gpbl
Comment options

gpbl Sep 27, 2023
Maintainer

Answer selected by gpbl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants