refactor: cache the result of getLocale()

This commit is contained in:
Benjy Cui 2015-11-21 16:48:35 +08:00
parent dc9dd43e39
commit bbadcc34c1

View File

@ -87,18 +87,19 @@ function createPicker(TheCalendar) {
this.props.onChange(timeValue);
},
render() {
const locale = this.getLocale();
//
//
//
let defaultCalendarValue = new GregorianCalendar(this.getLocale());
let defaultCalendarValue = new GregorianCalendar(locale);
defaultCalendarValue.setTime(Date.now());
const placeholder = ('placeholder' in this.props)
? this.props.placeholder : this.getLocale().lang.placeholder;
? this.props.placeholder : locale.lang.placeholder;
const calendar = (
<TheCalendar
disabledDate={this.props.disabledDate}
locale={this.getLocale().lang}
locale={locale.lang}
defaultValue={defaultCalendarValue}
dateInputPlaceholder={placeholder}
showTime={this.props.showTime}