]> git.immae.eu Git - github/fretlink/time-picker.git/blob - examples/pick-time.js
fix value
[github/fretlink/time-picker.git] / examples / pick-time.js
1 import 'rc-time-picker/assets/index.less';
2
3 import React from 'react';
4 import ReactDom from 'react-dom';
5
6 import GregorianCalendar from 'gregorian-calendar';
7 import DateTimeFormat from 'gregorian-calendar-format';
8 import zhCn from 'gregorian-calendar/lib/locale/zh_CN';
9
10 import TimePicker from 'rc-time-picker';
11 import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN';
12
13 const formatter = new DateTimeFormat('HH:mm:ss');
14
15 const now = new GregorianCalendar(zhCn);
16 now.setTime(Date.now());
17
18 function onChange(v) {
19 console.log(v && formatter.format(v));
20 }
21
22 ReactDom.render(
23 <TimePicker formatter={formatter} locale={TimePickerLocale} defaultValue={now} onChange={onChange}/>,
24 document.getElementById('__react-content')
25 );