diff options
author | MG12 <wuzhao.mail@gmail.com> | 2015-11-19 15:15:03 +0800 |
---|---|---|
committer | MG12 <wuzhao.mail@gmail.com> | 2015-11-19 15:15:03 +0800 |
commit | 11b97949da16fc090400a753189baf10f29c111f (patch) | |
tree | aee755ef1eced68f70cca5d0427c75ab76ac7b36 /src/module/Combobox.jsx | |
parent | e75ed0c6b89282cf475e94d6d5ad0fb35803f974 (diff) | |
download | time-picker-11b97949da16fc090400a753189baf10f29c111f.tar.gz time-picker-11b97949da16fc090400a753189baf10f29c111f.tar.zst time-picker-11b97949da16fc090400a753189baf10f29c111f.zip |
use another method to change time and fix the bug about value.getTime()
Diffstat (limited to 'src/module/Combobox.jsx')
-rw-r--r-- | src/module/Combobox.jsx | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/module/Combobox.jsx b/src/module/Combobox.jsx index e6fe5ed..afce675 100644 --- a/src/module/Combobox.jsx +++ b/src/module/Combobox.jsx | |||
@@ -23,13 +23,13 @@ const Combobox = React.createClass({ | |||
23 | 23 | ||
24 | onItemChange(type, itemValue) { | 24 | onItemChange(type, itemValue) { |
25 | const { value, onChange } = this.props; | 25 | const { value, onChange } = this.props; |
26 | let index = 4; | 26 | if (type === 'hour') { |
27 | if (type === 'minute') { | 27 | value.setHourOfDay(itemValue); |
28 | index = 5; | 28 | } else if (type === 'minute') { |
29 | } else if (type === 'second') { | 29 | value.setMinutes(itemValue); |
30 | index = 6; | 30 | } else { |
31 | value.setSeconds(itemValue); | ||
31 | } | 32 | } |
32 | value.fields[index] = itemValue; | ||
33 | onChange(value); | 33 | onChange(value); |
34 | }, | 34 | }, |
35 | 35 | ||
@@ -80,13 +80,12 @@ const Combobox = React.createClass({ | |||
80 | 80 | ||
81 | render() { | 81 | render() { |
82 | const { prefixCls, value } = this.props; | 82 | const { prefixCls, value } = this.props; |
83 | const timeFields = value.fields; | ||
84 | 83 | ||
85 | return ( | 84 | return ( |
86 | <div className={`${prefixCls}-combobox`}> | 85 | <div className={`${prefixCls}-combobox`}> |
87 | {this.getHourSelect(timeFields[4])} | 86 | {this.getHourSelect(value.getHourOfDay())} |
88 | {this.getMinuteSelect(timeFields[5])} | 87 | {this.getMinuteSelect(value.getMinutes())} |
89 | {this.getSectionSelect(timeFields[6])} | 88 | {this.getSectionSelect(value.getSeconds())} |
90 | </div> | 89 | </div> |
91 | ); | 90 | ); |
92 | }, | 91 | }, |