aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/TimePicker.jsx18
-rw-r--r--src/locale/en_US.js2
-rw-r--r--src/locale/zh_CN.js2
3 files changed, 8 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}
diff --git a/src/locale/en_US.js b/src/locale/en_US.js
index 488725c..506f4c9 100644
--- a/src/locale/en_US.js
+++ b/src/locale/en_US.js
@@ -1,6 +1,8 @@
1import enUs from 'gregorian-calendar-format/lib/locale/en_US'; 1import enUs from 'gregorian-calendar-format/lib/locale/en_US';
2import enUsCalendar from 'gregorian-calendar/lib/locale/en_US';
2 3
3export default { 4export default {
4 clear: 'Clear', 5 clear: 'Clear',
5 format: enUs, 6 format: enUs,
7 calendar: enUsCalendar,
6}; 8};
diff --git a/src/locale/zh_CN.js b/src/locale/zh_CN.js
index 8e02a08..1e977be 100644
--- a/src/locale/zh_CN.js
+++ b/src/locale/zh_CN.js
@@ -1,6 +1,8 @@
1import zhCn from 'gregorian-calendar-format/lib/locale/zh_CN'; 1import zhCn from 'gregorian-calendar-format/lib/locale/zh_CN';
2import zhCnCalendar from 'gregorian-calendar/lib/locale/zh_CN';
2 3
3export default { 4export default {
4 clear: '清除', 5 clear: '清除',
5 format: zhCn, 6 format: zhCn,
7 calendar: zhCnCalendar,
6}; 8};