@@ -12,10 +12,6 @@ desc: 基本用法,日期选择器。
1212import React from " react" ;
1313import moment from " moment" ;
1414import { CPicker as DatePicker , Form , Field , Toggle } from " cloud-react" ;
15- import React from " react" ;
16- import moment from " moment" ;
17- import { CPicker as DatePicker , Form , Field , Toggle } from " cloud-react" ;
18-
1915const { TimePicker } = DatePicker;
2016
2117const presets = [
@@ -36,31 +32,8 @@ const presets = [
3632 value : () =>
3733 moment ().clone ().subtract (1 , " years" ).format (" yyyy/MM/DD HH:mm:ss" ),
3834 },
39- {
40- label: " 三天前" ,
41- value : () => moment ().clone ().subtract (2 , " days" ),
42- },
43- {
44- label: " 一周前" ,
45- value : () => moment ().clone ().subtract (6 , " days" ),
46- },
47- {
48- label: " 一月前" ,
49- value : () => moment ().clone ().subtract (1 , " months" ).toDate (),
50- },
51- {
52- label: " 一年前" ,
53- value : () =>
54- moment ().clone ().subtract (1 , " years" ).format (" yyyy/MM/DD HH:mm:ss" ),
55- },
5635];
5736
58- const timePresets = [
59- {
60- label: " 中午" ,
61- value : () => moment ().clone ().startOf (" day" ).add (12 , " hours" ),
62- },
63- ];
6437const timePresets = [
6538 {
6639 label: " 中午" ,
@@ -81,10 +54,6 @@ class DatePickerDemo extends React.Component {
8154 this .setState ({ value });
8255 };
8356
84- onTimeChange = (time ) => {
85- console .log (" time:" , time);
86- this .setState ({ time });
87- };
8857 onTimeChange = (time ) => {
8958 console .log (" time:" , time);
9059 this .setState ({ time });
0 commit comments