From d360614938e1f73d1a564ca5c1d243e58ec6c187 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 8 Dec 2015 16:39:16 +0800 Subject: Add demo --- examples/value-and-defaultValue.html | 1 + examples/value-and-defaultValue.js | 46 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 examples/value-and-defaultValue.html create mode 100644 examples/value-and-defaultValue.js diff --git a/examples/value-and-defaultValue.html b/examples/value-and-defaultValue.html new file mode 100644 index 0000000..48cdce8 --- /dev/null +++ b/examples/value-and-defaultValue.html @@ -0,0 +1 @@ +placeholder diff --git a/examples/value-and-defaultValue.js b/examples/value-and-defaultValue.js new file mode 100644 index 0000000..67771c0 --- /dev/null +++ b/examples/value-and-defaultValue.js @@ -0,0 +1,46 @@ +/* eslint no-console:0 */ + +import 'rc-time-picker/assets/index.less'; + +import React from 'react'; +import ReactDom from 'react-dom'; + +import GregorianCalendar from 'gregorian-calendar'; +import DateTimeFormat from 'gregorian-calendar-format'; +import zhCn from 'gregorian-calendar/lib/locale/zh_CN'; + +import TimePicker from 'rc-time-picker'; +import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN'; + +const formatter = new DateTimeFormat('HH:mm:ss'); + +const now = new GregorianCalendar(zhCn); +now.setTime(Date.now()); + +const App = React.createClass({ + getInitialState() { + return { + value: now, + }; + }, + handleValueChange(value) { + console.log(value && formatter.format(value)); + this.setState({ value }); + }, + render() { + return ( +
+ + +
+ ); + } +}); + +ReactDom.render( + , + document.getElementById('__react-content') +); -- cgit v1.2.3