aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/value-and-defaultValue.js
diff options
context:
space:
mode:
authoryiminghe <yiminghe@gmail.com>2016-01-14 13:59:59 +0800
committeryiminghe <yiminghe@gmail.com>2016-01-14 13:59:59 +0800
commit6fc4e0e8e2f7bd8bbcbb759a69bc7b94930f131c (patch)
tree5e9a993e8f42c933912d677239a6705869c2c214 /examples/value-and-defaultValue.js
parentdb4e4d6ec057ac1bff98d86bd1c42085ebc1b306 (diff)
downloadtime-picker-6fc4e0e8e2f7bd8bbcbb759a69bc7b94930f131c.tar.gz
time-picker-6fc4e0e8e2f7bd8bbcbb759a69bc7b94930f131c.tar.zst
time-picker-6fc4e0e8e2f7bd8bbcbb759a69bc7b94930f131c.zip
remove gregorianCalendarLocale1.1.0
Diffstat (limited to 'examples/value-and-defaultValue.js')
-rw-r--r--examples/value-and-defaultValue.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/value-and-defaultValue.js b/examples/value-and-defaultValue.js
index 404c963..1be30cc 100644
--- a/examples/value-and-defaultValue.js
+++ b/examples/value-and-defaultValue.js
@@ -7,14 +7,12 @@ import ReactDom from 'react-dom';
7 7
8import GregorianCalendar from 'gregorian-calendar'; 8import GregorianCalendar from 'gregorian-calendar';
9import DateTimeFormat from 'gregorian-calendar-format'; 9import DateTimeFormat from 'gregorian-calendar-format';
10import zhCn from 'gregorian-calendar/lib/locale/zh_CN';
11
12import TimePicker from 'rc-time-picker'; 10import TimePicker from 'rc-time-picker';
13import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN'; 11import TimePickerLocale from 'rc-time-picker/src/locale/zh_CN';
14 12
15const formatter = new DateTimeFormat('HH:mm:ss'); 13const formatter = new DateTimeFormat('HH:mm:ss');
16 14
17const now = new GregorianCalendar(zhCn); 15const now = new GregorianCalendar(TimePickerLocale.calendar);
18now.setTime(Date.now()); 16now.setTime(Date.now());
19 17
20const App = React.createClass({ 18const App = React.createClass({
@@ -27,6 +25,11 @@ const App = React.createClass({
27 console.log(value && formatter.format(value)); 25 console.log(value && formatter.format(value));
28 this.setState({ value }); 26 this.setState({ value });
29 }, 27 },
28 clear() {
29 this.setState({
30 value: undefined,
31 });
32 },
30 render() { 33 render() {
31 return ( 34 return (
32 <div> 35 <div>
@@ -35,6 +38,7 @@ const App = React.createClass({
35 <TimePicker formatter={formatter} locale={TimePickerLocale} 38 <TimePicker formatter={formatter} locale={TimePickerLocale}
36 value={this.state.value} 39 value={this.state.value}
37 onChange={this.handleValueChange}/> 40 onChange={this.handleValueChange}/>
41 <button onClick={this.clear}>clear</button>
38 </div> 42 </div>
39 ); 43 );
40 }, 44 },