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 | |
parent | 1370f11cb101e4cf3eef1dedd501e8c9d954ab3c (diff) | |
download | time-picker-aed96fd625c23d720f0f4a684c1fcd62b7399be7.tar.gz time-picker-aed96fd625c23d720f0f4a684c1fcd62b7399be7.tar.zst time-picker-aed96fd625c23d720f0f4a684c1fcd62b7399be7.zip |
fixed bugs when value empty.
-rw-r--r-- | HISTORY.md | 5 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | src/module/Combobox.jsx | 6 | ||||
-rw-r--r-- | src/module/Panel.jsx | 4 |
4 files changed, 12 insertions, 5 deletions
@@ -2,6 +2,11 @@ | |||
2 | 2 | ||
3 | --- | 3 | --- |
4 | 4 | ||
5 | 1.0.0-alpha9 / 2015-12-16 | ||
6 | ------------------ | ||
7 | |||
8 | `fixed` update bugs when value empty. | ||
9 | |||
5 | 1.0.0-alpha7 / 2015-12-12 | 10 | 1.0.0-alpha7 / 2015-12-12 |
6 | ------------------ | 11 | ------------------ |
7 | 12 | ||
diff --git a/package.json b/package.json index a8ca6ad..61aabc7 100644 --- a/package.json +++ b/package.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "name": "rc-time-picker", | 2 | "name": "rc-time-picker", |
3 | "version": "1.0.0-alpha8", | 3 | "version": "1.0.0-alpha9", |
4 | "description": "React TimePicker", | 4 | "description": "React TimePicker", |
5 | "keywords": [ | 5 | "keywords": [ |
6 | "react", | 6 | "react", |
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); |