aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/TimePicker.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/TimePicker.jsx')
-rw-r--r--src/TimePicker.jsx18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/TimePicker.jsx b/src/TimePicker.jsx
index ad4e834..f9b9207 100644
--- a/src/TimePicker.jsx
+++ b/src/TimePicker.jsx
@@ -4,7 +4,6 @@ import Panel from './module/Panel';
4import placements from './util/placements'; 4import placements from './util/placements';
5import CommonMixin from './mixin/CommonMixin'; 5import CommonMixin from './mixin/CommonMixin';
6import {getFormatter} from './util/index'; 6import {getFormatter} from './util/index';
7import defaultGregorianCalendarLocale from 'gregorian-calendar/lib/locale/en_US';
8 7
9function noop() { 8function noop() {
10} 9}
@@ -27,7 +26,6 @@ const Picker = React.createClass({
27 placement: PropTypes.any, 26 placement: PropTypes.any,
28 transitionName: PropTypes.string, 27 transitionName: PropTypes.string,
29 getPopupContainer: PropTypes.func, 28 getPopupContainer: PropTypes.func,
30 gregorianCalendarLocale: PropTypes.object,
31 placeholder: PropTypes.string, 29 placeholder: PropTypes.string,
32 formatter: PropTypes.any, 30 formatter: PropTypes.any,
33 showHour: PropTypes.bool, 31 showHour: PropTypes.bool,
@@ -50,7 +48,6 @@ const Picker = React.createClass({
50 defaultOpen: false, 48 defaultOpen: false,
51 style: {}, 49 style: {},
52 className: '', 50 className: '',
53 gregorianCalendarLocale: defaultGregorianCalendarLocale,
54 align: {}, 51 align: {},
55 allowEmpty: true, 52 allowEmpty: true,
56 showHour: true, 53 showHour: true,
@@ -77,7 +74,7 @@ const Picker = React.createClass({
77 74
78 componentWillReceiveProps(nextProps) { 75 componentWillReceiveProps(nextProps) {
79 const { value, open } = nextProps; 76 const { value, open } = nextProps;
80 if (value !== undefined) { 77 if ('value' in nextProps) {
81 this.setState({ 78 this.setState({
82 value, 79 value,
83 }); 80 });
@@ -150,22 +147,15 @@ const Picker = React.createClass({
150 }, 147 },
151 148
152 getPanelElement() { 149 getPanelElement() {
153 const { prefixCls, defaultValue, locale, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond, gregorianCalendarLocale, value } = this.props; 150 const { prefixCls, defaultValue, locale, placeholder, disabledHours,
154 let calendarLocale; 151 disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond } = this.props;
155 if (value) {
156 calendarLocale = value.locale;
157 } else if (defaultValue) {
158 calendarLocale = defaultValue.locale;
159 } else {
160 calendarLocale = gregorianCalendarLocale;
161 }
162 return ( 152 return (
163 <Panel 153 <Panel
164 prefixCls={`${prefixCls}-panel`} 154 prefixCls={`${prefixCls}-panel`}
165 ref={this.savePanelRef} 155 ref={this.savePanelRef}
166 value={this.state.value} 156 value={this.state.value}
167 onChange={this.onPanelChange} 157 onChange={this.onPanelChange}
168 gregorianCalendarLocale={calendarLocale} 158 gregorianCalendarLocale={locale.calendar}
169 onClear={this.onPanelClear} 159 onClear={this.onPanelClear}
170 defaultValue={defaultValue} 160 defaultValue={defaultValue}
171 showHour={showHour} 161 showHour={showHour}