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} 

github/example/picktime.js


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -