Calendar locale prop should have priority

close #12706
This commit is contained in:
afc163 2018-10-18 23:30:40 +08:00
parent 2c5366603c
commit fb2e355f14

View File

@ -240,11 +240,23 @@ export default class Calendar extends React.Component<CalendarProps, CalendarSta
);
}
getDefaultLocale = () => {
const result = {
...enUS,
...this.props.locale,
};
result.lang = {
...result.lang,
...(this.props.locale || {}).lang,
};
return result;
}
render() {
return (
<LocaleReceiver
componentName="Calendar"
defaultLocale={enUS}
defaultLocale={this.getDefaultLocale}
>
{this.renderCalendar}
</LocaleReceiver>