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