From 11b97949da16fc090400a753189baf10f29c111f Mon Sep 17 00:00:00 2001 From: MG12 Date: Thu, 19 Nov 2015 15:15:03 +0800 Subject: use another method to change time and fix the bug about value.getTime() --- src/module/Combobox.jsx | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/module/Combobox.jsx') 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({ onItemChange(type, itemValue) { const { value, onChange } = this.props; - let index = 4; - if (type === 'minute') { - index = 5; - } else if (type === 'second') { - index = 6; + if (type === 'hour') { + value.setHourOfDay(itemValue); + } else if (type === 'minute') { + value.setMinutes(itemValue); + } else { + value.setSeconds(itemValue); } - value.fields[index] = itemValue; onChange(value); }, @@ -80,13 +80,12 @@ const Combobox = React.createClass({ render() { const { prefixCls, value } = this.props; - const timeFields = value.fields; return (
- {this.getHourSelect(timeFields[4])} - {this.getMinuteSelect(timeFields[5])} - {this.getSectionSelect(timeFields[6])} + {this.getHourSelect(value.getHourOfDay())} + {this.getMinuteSelect(value.getMinutes())} + {this.getSectionSelect(value.getSeconds())}
); }, -- cgit v1.2.3