onefinestay / react-daterange-picker

Other
563 stars 208 forks source link

CalendarMonth accepts customizable week and month names as props #136

Open procidac opened 8 years ago

procidac commented 8 years ago

Hi @AlanFoster @AndrewIngram,

I'd like to contribute a backwards compatible improvement to react-daterange-picker that allows consumers to override the default labels for month and weekday names.

A consumer would pass the custom labels as props as follows:

const lang = moment().localeData();
const MONTHS = Immutable.List(moment.monthsShort());
const WEEKDAYS = Immutable
        .List(lang._weekdays)
        .zip(Immutable.List(moment.weekdaysMin().map(name => name.substring(0, 1))));
return (
  <DateRangePicker
        monthNames={MONTHS}
        weekdayNames={WEEKDAYS} />
);

The default labels would be used if props are not set. The two new props are independent and can be set separately.

procidac commented 8 years ago

Hi @AlanFoster I would appreciate if you could look into this proposed improvement, thanks!