diff options
author | MG12 <wuzhao.mail@gmail.com> | 2015-12-16 16:45:08 +0800 |
---|---|---|
committer | MG12 <wuzhao.mail@gmail.com> | 2015-12-16 16:45:08 +0800 |
commit | aed96fd625c23d720f0f4a684c1fcd62b7399be7 (patch) | |
tree | c0d56577959323b8cb89704135f25c39f0e0bfb3 /src/module | |
parent | 1370f11cb101e4cf3eef1dedd501e8c9d954ab3c (diff) | |
download | time-picker-aed96fd625c23d720f0f4a684c1fcd62b7399be7.tar.gz time-picker-aed96fd625c23d720f0f4a684c1fcd62b7399be7.tar.zst time-picker-aed96fd625c23d720f0f4a684c1fcd62b7399be7.zip |
fixed bugs when value empty.
Diffstat (limited to 'src/module')
-rw-r--r-- | src/module/Combobox.jsx | 6 | ||||
-rw-r--r-- | src/module/Panel.jsx | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/module/Combobox.jsx b/src/module/Combobox.jsx index 7374b39..f1e7c5b 100644 --- a/src/module/Combobox.jsx +++ b/src/module/Combobox.jsx | |||
@@ -79,7 +79,8 @@ const Combobox = React.createClass({ | |||
79 | }, | 79 | }, |
80 | 80 | ||
81 | getMinuteSelect(minute) { | 81 | getMinuteSelect(minute) { |
82 | const { prefixCls, minuteOptions, disabledMinutes, value } = this.props; | 82 | const { prefixCls, minuteOptions, disabledMinutes } = this.props; |
83 | const value = this.props.value || this.getNow(); | ||
83 | const disabledOptions = disabledMinutes(value.getHourOfDay()); | 84 | const disabledOptions = disabledMinutes(value.getHourOfDay()); |
84 | 85 | ||
85 | return ( | 86 | return ( |
@@ -95,10 +96,11 @@ const Combobox = React.createClass({ | |||
95 | }, | 96 | }, |
96 | 97 | ||
97 | getSecondSelect(second) { | 98 | getSecondSelect(second) { |
98 | const { prefixCls, secondOptions, disabledSeconds, showSecond, value } = this.props; | 99 | const { prefixCls, secondOptions, disabledSeconds, showSecond } = this.props; |
99 | if (!showSecond) { | 100 | if (!showSecond) { |
100 | return null; | 101 | return null; |
101 | } | 102 | } |
103 | const value = this.props.value || this.getNow(); | ||
102 | const disabledOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes()); | 104 | const disabledOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes()); |
103 | 105 | ||
104 | return ( | 106 | return ( |
diff --git a/src/module/Panel.jsx b/src/module/Panel.jsx index 94d3842..4c3d071 100644 --- a/src/module/Panel.jsx +++ b/src/module/Panel.jsx | |||
@@ -78,8 +78,8 @@ const Panel = React.createClass({ | |||
78 | const { locale, prefixCls, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond, formatter, gregorianCalendarLocale } = this.props; | 78 | const { locale, prefixCls, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond, formatter, gregorianCalendarLocale } = this.props; |
79 | const value = this.state.value; | 79 | const value = this.state.value; |
80 | const disabledHourOptions = disabledHours(); | 80 | const disabledHourOptions = disabledHours(); |
81 | const disabledMinuteOptions = disabledMinutes(value.getHourOfDay()); | 81 | const disabledMinuteOptions = disabledMinutes(value ? value.getHourOfDay() : null); |
82 | const disabledSecondOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes()); | 82 | const disabledSecondOptions = disabledSeconds(value ? value.getHourOfDay() : null, value ? value.getMinutes() : null); |
83 | const hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions); | 83 | const hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions); |
84 | const minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions); | 84 | const minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions); |
85 | const secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions); | 85 | const secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions); |