I'm using the NextUI library version 2.3.6
. I'd like to use the DatePicker or the DateInput.
However, the default format displayed is mm/dd/yyyy
; I need to display the date in the following format: dd/mm/yyyy
.
Is there any way of using a format other than the default within a DatePicker
or a DateInput
?
I asked the question on the official NextUI Discord and they gave me the solution!
All you have to do is change the locale on the NextUIProvider
, for example :
"use client";
import {type ReactNode} from "react";
import {NextUIProvider} from "@nextui-org/react";
export function AppProvider(props: AppProviderProps) {
const {children, className} = props;
return (
<NextUIProvider locale="fr-FR" className={className}>
{children}
</NextUIProvider>
);
}
interface AppProviderProps {
children: ReactNode;
className?: string;
}