ant-design/components/datepicker/demo/time.md
2015-11-19 15:53:40 +08:00

604 B

时间选择

  • order: 4

时间选择组件 配合使用。


import { Datepicker, Timepicker } from 'antd';

function onDateChange(date) {
  console.log(date.toLocaleDateString());
}

function onTimeChange(time) {
  console.log(time.toLocaleTimeString());
  console.log('时', time.getHours());
  console.log('分', time.getMinutes());
  console.log('秒', time.getSeconds());
}

ReactDOM.render(<div>
  <Datepicker onChange={onDateChange} />
  <Timepicker onChange={onTimeChange} />
</div>, document.getElementById('components-datepicker-demo-time'));