node.js - Can't get the value from rc-time-picker -
basically this:
<timepicker id="starttime" showsecond={false} defaultvalue={now} classname="xxx" onchange={function(){ console.log(this.value); }} format={format} use12hours disabled={dateblocked} name="starttime" />
is logging:
undefined
to console. why not it's date moment?
this
console.log(this.defaultvalue);
works fine.
value
the timepicker's value
it's provide argument theonchange
event.
it should be:
onchange={ function(value){console.log(value)} }
example
// display seconds const showsecond = true; //format string const str = showsecond ? 'hh:mm:ss' : 'hh:mm'; //handle onchange event function handlechange(value) { console.log(value && value.format(str)); } ... onchange={handlechange}
Comments
Post a Comment