Reputation: 623
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 the console. Why not it's date as a moment?
This
console.log(this.defaultValue);
Works fine.
Upvotes: 0
Views: 2162
Reputation: 2154
The timePicker's value
it's provide as an argument
by theOnChange
event.
onChange={ function(value){console.log(value)} }
// 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}
Upvotes: 1