]> git.immae.eu Git - github/fretlink/time-picker.git/commitdiff
fixed bugs when value empty.
authorMG12 <wuzhao.mail@gmail.com>
Wed, 16 Dec 2015 08:45:08 +0000 (16:45 +0800)
committerMG12 <wuzhao.mail@gmail.com>
Wed, 16 Dec 2015 08:45:08 +0000 (16:45 +0800)
HISTORY.md
package.json
src/module/Combobox.jsx
src/module/Panel.jsx

index 48c386ad29bb4dc230d3a5f96f393a02435e3a82..f72f67a61c2621e39bb5f174b68109f765b73865 100644 (file)
@@ -2,6 +2,11 @@
 
 ---
 
+1.0.0-alpha9 / 2015-12-16
+------------------
+
+`fixed` update bugs when value empty.
+
 1.0.0-alpha7 / 2015-12-12
 ------------------
 
index a8ca6ad3bceeb6074247424b4d7f670ff8c0ebbc..61aabc73b39abc43de92cbd0b04cf5039f402934 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "rc-time-picker",
-  "version": "1.0.0-alpha8",
+  "version": "1.0.0-alpha9",
   "description": "React TimePicker",
   "keywords": [
     "react",
index 7374b391e5100919c707a2f2439d1b84c2a29d37..f1e7c5bd3ded0d37481c4f2e68e685ef1ec5622b 100644 (file)
@@ -79,7 +79,8 @@ const Combobox = React.createClass({
   },
 
   getMinuteSelect(minute) {
-    const { prefixCls, minuteOptions, disabledMinutes, value } = this.props;
+    const { prefixCls, minuteOptions, disabledMinutes } = this.props;
+    const value = this.props.value || this.getNow();
     const disabledOptions = disabledMinutes(value.getHourOfDay());
 
     return (
@@ -95,10 +96,11 @@ const Combobox = React.createClass({
   },
 
   getSecondSelect(second) {
-    const { prefixCls, secondOptions, disabledSeconds, showSecond, value } = this.props;
+    const { prefixCls, secondOptions, disabledSeconds, showSecond } = this.props;
     if (!showSecond) {
       return null;
     }
+    const value = this.props.value || this.getNow();
     const disabledOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes());
 
     return (
index 94d3842a608a64cde73ce73d41d87c692a960ef3..4c3d071c0115e7f8da3ecf46bad471d726cc9e1a 100644 (file)
@@ -78,8 +78,8 @@ const Panel = React.createClass({
     const { locale, prefixCls, placeholder, disabledHours, disabledMinutes, disabledSeconds, hideDisabledOptions, allowEmpty, showHour, showSecond, formatter, gregorianCalendarLocale } = this.props;
     const value = this.state.value;
     const disabledHourOptions = disabledHours();
-    const disabledMinuteOptions = disabledMinutes(value.getHourOfDay());
-    const disabledSecondOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes());
+    const disabledMinuteOptions = disabledMinutes(value ? value.getHourOfDay() : null);
+    const disabledSecondOptions = disabledSeconds(value ? value.getHourOfDay() : null, value ? value.getMinutes() : null);
     const hourOptions = generateOptions(24, disabledHourOptions, hideDisabledOptions);
     const minuteOptions = generateOptions(60, disabledMinuteOptions, hideDisabledOptions);
     const secondOptions = generateOptions(60, disabledSecondOptions, hideDisabledOptions);