aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/module/Header.jsx
diff options
context:
space:
mode:
authorMG12 <wuzhao.mail@gmail.com>2015-12-14 00:50:41 +0800
committerMG12 <wuzhao.mail@gmail.com>2015-12-14 00:50:41 +0800
commit71bd9bc11f2ca6068f7977ff3511b2798f73d0c6 (patch)
treee24404e929db29204fa008546377351d314f9480 /src/module/Header.jsx
parent0e62bf0b7bdc260e882fd185492939cbaed04d56 (diff)
downloadtime-picker-71bd9bc11f2ca6068f7977ff3511b2798f73d0c6.tar.gz
time-picker-71bd9bc11f2ca6068f7977ff3511b2798f73d0c6.tar.zst
time-picker-71bd9bc11f2ca6068f7977ff3511b2798f73d0c6.zip
update disabled options
Diffstat (limited to 'src/module/Header.jsx')
-rw-r--r--src/module/Header.jsx15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/module/Header.jsx b/src/module/Header.jsx
index fec02af..9a048dc 100644
--- a/src/module/Header.jsx
+++ b/src/module/Header.jsx
@@ -13,9 +13,9 @@ const Header = React.createClass({
13 hourOptions: PropTypes.array, 13 hourOptions: PropTypes.array,
14 minuteOptions: PropTypes.array, 14 minuteOptions: PropTypes.array,
15 secondOptions: PropTypes.array, 15 secondOptions: PropTypes.array,
16 disabledHours: PropTypes.array, 16 disabledHours: PropTypes.func,
17 disabledMinutes: PropTypes.array, 17 disabledMinutes: PropTypes.func,
18 disabledSeconds: PropTypes.array, 18 disabledSeconds: PropTypes.func,
19 onChange: PropTypes.func, 19 onChange: PropTypes.func,
20 onClear: PropTypes.func, 20 onClear: PropTypes.func,
21 onEsc: PropTypes.func, 21 onEsc: PropTypes.func,
@@ -87,10 +87,13 @@ const Header = React.createClass({
87 } 87 }
88 88
89 // if time value is disabled, response warning. 89 // if time value is disabled, response warning.
90 const disabledHourOptions = disabledHours();
91 const disabledMinuteOptions = disabledMinutes(value.getHourOfDay());
92 const disabledSecondOptions = disabledSeconds(value.getHourOfDay(), value.getMinutes());
90 if ( 93 if (
91 (disabledHours && disabledHours.indexOf(value.getHourOfDay()) >= 0) || 94 (disabledHourOptions && disabledHourOptions.indexOf(value.getHourOfDay()) >= 0) ||
92 (disabledMinutes && disabledMinutes.indexOf(value.getMinutes()) >= 0) || 95 (disabledMinuteOptions && disabledMinuteOptions.indexOf(value.getMinutes()) >= 0) ||
93 (disabledSeconds && disabledSeconds.indexOf(value.getSeconds()) >= 0) 96 (disabledSecondOptions && disabledSecondOptions.indexOf(value.getSeconds()) >= 0)
94 ) { 97 ) {
95 this.setState({ 98 this.setState({
96 invalid: true, 99 invalid: true,