react-date-range
react-date-range copied to clipboard
Locale prop doesn't exist on Calendar
Subject of the issue
The locale prop doesn't exist on the Calendar using typescript. There's only the lang-prop with about 5 different languages but the documentation says otherwise.
[BUG] Bug Reproduce Steps
import * as dateFnsLocales from "date-fns/locale";
export default function () {
return
<Calendar locale={dateFnsLocales["de"]}/>
}
[BUG] Expected behaviour
Calendar should use locale-prop like DateRangePicker instead of lang-prop when using typescript.
Environment
Using Typescript Package Version: 1.3.0 Types Version: 1.1.5
Are you sure, it seems right to me: https://github.com/hypeserver/react-date-range/blob/master/src/components/Calendar/index.js#L35-L37
Are you sure, it seems right to me: https://github.com/hypeserver/react-date-range/blob/master/src/components/Calendar/index.js#L35-L37
Yes, I think it's a problem with @types/react-date-range missing the locale in the Calendar Props interface as I am using typescript:
export interface CommonCalendarProps { /** default: DD/MM/YYY */ format?: string; firstDayOfWeek?: number; theme?: CalendarTheme; /** default: none */ onInit?: (range: Range) => void; /** default: none */ onChange?: (range: Range) => void; /** default: none */ minDate?: DateInputType; /** default: none */ maxDate?: DateInputType; /** * Calendar languages. * ('cn' - Chinese, 'jp' - Japanese, * 'fr' - French, 'it' - Italian, * 'de' - German, 'ko' - Korean, * 'es' - Spanish, 'ru' - Russian, * 'tr' - Turkish) default: none */ lang?: LanguageType; }
I've opened a pull request on DefinitelyTyped that should fix this issue.
DefinitelyTyped is unfortunately very outdated. I have started a Pr to hopefully add full TS support: https://github.com/hypeserver/react-date-range/pull/499 If you have time would appreciate if you could take a look and even better try it?