@momo-kits/date-picker 0.0.65-alpha.16 → 0.0.65-alpha.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,770 +1,799 @@
1
1
  /* eslint-disable max-len */
2
2
  /* eslint-disable react/no-unused-prop-types */
3
- import React, {Component} from 'react';
4
- import {View, StyleSheet, Dimensions} from 'react-native';
3
+ import React, { Component } from 'react';
4
+ import { View, StyleSheet, Dimensions } from 'react-native';
5
5
  import PropTypes from 'prop-types';
6
6
  import {
7
- BottomPopupHeader,
8
- Button,
9
- Text,
10
- ScreenUtils,
11
- SwitchLanguage,
12
- Spacing,
13
- Colors,
14
- } from '@momo-kits/core-v2';
7
+ BottomPopupHeader,
8
+ Button,
9
+ Text,
10
+ ScreenUtils,
11
+ SwitchLanguage,
12
+ Spacing,
13
+ Colors,
14
+ } from '@momo-kits/core';
15
15
  import WheelPicker from './WheelPicker';
16
16
  import DatePickerHelper from './helper/DatePickerHelper';
17
17
 
18
- const {ifIphoneX} = ScreenUtils;
18
+ const { ifIphoneX } = ScreenUtils;
19
19
 
20
20
  const widthScreen = Dimensions.get('window').width;
21
21
  const styles = StyleSheet.create({
22
- container: {
23
- width: widthScreen,
24
- alignItems: 'center',
25
- justifyContent: 'center',
26
- paddingHorizontal: 6,
27
- },
28
- content: {
29
- flexDirection: 'row',
30
- width: widthScreen,
31
- alignItems: 'center',
32
- justifyContent: 'center',
33
- paddingHorizontal: 21,
34
- paddingTop: 12,
35
- },
36
- column: {
37
- borderWidth: 2,
38
- borderColor: 'red',
39
- },
40
- header: {
41
- borderTopLeftRadius: 12,
42
- borderTopRightRadius: 12,
43
- //backgroundColor:'red',
44
- height: 64,
45
- borderBottomColor: Colors.black_04,
46
- borderBottomWidth: 1,
47
- alignItems: 'center',
48
- justifyContent: 'center',
49
- marginBottom: 0, // Spacing.S,
50
- },
51
- view: {
52
- backgroundColor: 'white',
53
- borderTopRightRadius: 16,
54
- borderTopLeftRadius: 16,
55
- overflow: 'hidden',
56
- },
57
- titleCancel: {
58
- fontSize: 17,
59
- color: '#4A90E2',
60
- },
61
- titleConfirm: {
62
- fontSize: 17,
63
- color: '#4A90E2',
64
- textAlign: 'right',
65
- },
22
+ container: {
23
+ width: widthScreen,
24
+ alignItems: 'center',
25
+ justifyContent: 'center',
26
+ paddingHorizontal: 6,
27
+ },
28
+ content: {
29
+ flexDirection: 'row',
30
+ width: widthScreen,
31
+ alignItems: 'center',
32
+ justifyContent: 'center',
33
+ paddingHorizontal: 21,
34
+ paddingTop: 12,
35
+ },
36
+ column: {
37
+ borderWidth: 2,
38
+ borderColor: 'red',
39
+ },
40
+ header: {
41
+ borderTopLeftRadius: 12,
42
+ borderTopRightRadius: 12,
43
+ //backgroundColor:'red',
44
+ height: 64,
45
+ borderBottomColor: Colors.black_04,
46
+ borderBottomWidth: 1,
47
+ alignItems: 'center',
48
+ justifyContent: 'center',
49
+ marginBottom: 0, // Spacing.S,
50
+ },
51
+ view: {
52
+ backgroundColor: 'white',
53
+ borderTopRightRadius: 16,
54
+ borderTopLeftRadius: 16,
55
+ overflow: 'hidden',
56
+ },
57
+ titleCancel: {
58
+ fontSize: 17,
59
+ color: '#4A90E2',
60
+ },
61
+ titleConfirm: {
62
+ fontSize: 17,
63
+ color: '#4A90E2',
64
+ textAlign: 'right',
65
+ },
66
66
  });
67
67
 
68
- const getStrings = strings => (strings?.length === 1 ? `0${strings}` : strings);
69
-
68
+ const getStrings = (strings) =>
69
+ strings?.length === 1 ? `0${strings}` : strings;
70
70
  class DatePicker extends Component {
71
- constructor(props) {
72
- super(props);
73
- this.initDefault(props);
74
- }
75
-
76
- // onBackPress = () => {
77
- // this.hide();
78
- // return true;
79
- // }
80
-
81
- componentDidMount() {
82
- // BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
83
- // BackHandler.addEventListener('hardwareBackPress', this.onBackPress);
84
-
85
- // setTimeout(() => {
86
- // BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
87
- // BackHandler.addEventListener('hardwareBackPress', this.onBackPress);
88
- // }, 200);
89
-
90
- this.setStateMonth(this.dayIndex, this.monthIndex, this.yearIndex);
91
- const {onCreateRef} = this.props;
92
- if (typeof onCreateRef === 'function') onCreateRef(this);
93
- }
94
-
95
- componentWillUnmount() {
96
- // BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
97
- }
98
-
99
- initDefault(props) {
100
- if (props) {
101
- const propsMinDate = props.minDate ? props.minDate : props.minValue;
102
- const propsMaxDate = props.maxDate ? props.maxDate : props.maxValue;
103
- const propsSelectedDate = props.selectedDate
104
- ? props.selectedDate
105
- : props.value;
106
-
107
- if (propsMinDate) {
108
- this.minDate = DatePickerHelper.formatDate(propsMinDate, props.format);
109
- } else if (props.maxAge) {
110
- this.minDate = DatePickerHelper.calculateDateSinceYearAgo(props.maxAge);
111
- } else {
112
- this.minDate = null;
113
- }
114
-
115
- if (propsMaxDate) {
116
- this.maxDate = DatePickerHelper.formatDate(propsMaxDate, props.format);
117
- } else if (props.minAge) {
118
- this.maxDate = DatePickerHelper.calculateDateSinceYearAgo(props.minAge);
119
- } else {
120
- this.maxDate = null;
121
- }
122
-
123
- if (
124
- this.maxDate &&
125
- this.minDate &&
126
- this.maxDate.getTime() < this.minDate.getTime()
127
- ) {
128
- this.maxDate = null;
129
- this.minDate = null;
130
- }
131
-
132
- if (propsSelectedDate) {
133
- this.selectedDate = DatePickerHelper.formatDate(
134
- propsSelectedDate,
135
- props.format,
136
- );
137
- if (this.selectedDate) {
138
- if (
139
- this.minDate &&
140
- this.selectedDate.getTime() < this.minDate.getTime()
141
- ) {
142
- this.selectedDate = null;
143
- } else if (
144
- this.maxDate &&
145
- this.maxDate.getTime() < this.selectedDate.getTime()
146
- ) {
147
- this.selectedDate = null;
148
- }
149
- }
150
- } else {
151
- this.selectedDate = null;
152
- }
153
- if (props.format === 'hh:mm') {
154
- this.selectedDate = props.isRanged
155
- ? {
156
- from: DatePickerHelper.formatDate(
157
- propsSelectedDate.from,
158
- props.format,
159
- ),
160
- to: DatePickerHelper.formatDate(
161
- propsSelectedDate.to,
162
- props.format,
163
- ),
164
- }
165
- : DatePickerHelper.formatDate(propsSelectedDate, props.format);
166
- }
167
- }
168
- this.createDataDate(
169
- this.minDate,
170
- this.maxDate,
171
- props.minuteArray,
172
- props.startTime,
173
- props.endTime,
174
- props.rangeHour,
175
- );
176
- this.selectedIndexDate();
177
- }
178
-
179
- createDataDate(minDate, maxDate, minuteArray, startTime, endTime, rangeHour) {
180
- this.minDay = 1;
181
- this.minMonth = 1;
182
- this.minYear = 1970;
183
-
184
- this.maxDay = 31;
185
- this.maxMonth = 12;
186
- this.maxYear = 2100;
187
- if (minDate) {
188
- this.minDay = minDate.getDate();
189
- this.minMonth = minDate.getMonth() + 1;
190
- this.minYear = minDate.getFullYear();
191
- }
192
- if (maxDate) {
193
- this.maxDay = maxDate.getDate();
194
- this.maxMonth = maxDate.getMonth() + 1;
195
- this.maxYear = maxDate.getFullYear();
71
+ constructor(props) {
72
+ super(props);
73
+ this.initDefault(props);
196
74
  }
197
- this.days = DatePickerHelper.makeRange(1, 31);
198
- this.months = DatePickerHelper.makeRange(1, 12);
199
- this.years = DatePickerHelper.makeRange(this.minYear, this.maxYear);
200
- this.hours = DatePickerHelper.makeRange(0, 23, true);
201
- if (Array.isArray(minuteArray)) {
202
- this.minutes = minuteArray;
203
- } else {
204
- this.minutes = DatePickerHelper.makeRange(0, 59, true);
205
- }
206
- this.ranged = rangeHour || DatePickerHelper.arrayRange;
207
- }
208
-
209
- selectedIndexDate() {
210
- const {format, isRanged} = this.props;
211
- let current = new Date();
212
- if (this.minDate && current.getTime() < this.minDate.getTime()) {
213
- current = this.minDate;
214
- } else if (this.maxDate && current.getTime() > this.maxDate.getTime()) {
215
- current = this.maxDate;
216
- }
217
- if (format === 'hh:mm' && isRanged) {
218
- const valueHours_1 = this.selectedDate?.from
219
- ? `${getStrings(
220
- this.selectedDate?.from?.getHours()?.toString(),
221
- )}:${getStrings(this.selectedDate?.from?.getMinutes()?.toString())}`
222
- : '00:00';
223
- const valueHours_2 = this.selectedDate?.to
224
- ? `${getStrings(
225
- this.selectedDate?.to?.getHours()?.toString(),
226
- )}:${getStrings(this.selectedDate?.to?.getMinutes()?.toString())}`
227
- : '00:00';
228
- this.hourRangeIndex_1 = valueHours_1
229
- ? this.ranged.indexOf(valueHours_1)
230
- : this.ranged.indexOf(
231
- `${current.getHours().toString()}:${current
232
- .getMinutes()
233
- .toString()}`,
234
- );
235
-
236
- this.hourRangeIndex_2 = valueHours_2
237
- ? this.ranged.indexOf(valueHours_2)
238
- : this.ranged.indexOf(
239
- `${current.getHours().toString()}:${current
240
- .getMinutes()
241
- .toString()}`,
242
- );
243
- return;
244
- }
245
- this.dayIndex = this.selectedDate
246
- ? this.days.indexOf(this.selectedDate.getDate().toString())
247
- : this.days.indexOf(current.getDate().toString());
248
-
249
- this.monthIndex = this.selectedDate
250
- ? this.months.indexOf((this.selectedDate.getMonth() + 1).toString())
251
- : this.months.indexOf((current.getMonth() + 1).toString());
252
-
253
- this.yearIndex = this.selectedDate
254
- ? this.years.indexOf(this.selectedDate.getFullYear().toString())
255
- : this.years.indexOf(current.getFullYear().toString());
256
-
257
- if (format === 'hh:mm' && !isRanged) {
258
- const valueHours = this.selectedDate
259
- ? this.selectedDate?.getHours()?.toString()?.length === 1
260
- ? `0${this.selectedDate.getHours().toString()}`
261
- : this.selectedDate?.getHours()?.toString() || ''
262
- : '';
263
- const valueMinute = this.selectedDate
264
- ? this.selectedDate?.getMinutes()?.toString()?.length === 1
265
- ? `0${this.selectedDate.getMinutes().toString()}`
266
- : this.selectedDate?.getMinutes()?.toString() || ''
267
- : '';
268
-
269
- this.hourIndex = this.selectedDate
270
- ? this.hours.indexOf(valueHours)
271
- : this.hours.indexOf(
272
- current.getHours().toString().length === 1
273
- ? `0${current.getHours().toString()}`
274
- : current.getHours().toString(),
275
- );
276
-
277
- this.minuteIndex = this.selectedDate
278
- ? this.minutes.indexOf(valueMinute)
279
- : this.minutes.indexOf(
280
- current.getMinutes().toString().length === 1
281
- ? `0${current.getMinutes().toString()}`
282
- : current.getMinutes().toString(),
283
- );
284
- }
285
- }
286
-
287
- onBeginDrag = refName => {
288
- // eslint-disable-next-line no-restricted-syntax
289
- for (const i in this.arrayRef) {
290
- if (
291
- i &&
292
- i !== refName &&
293
- this.arrayRef &&
294
- this.arrayRef[i] &&
295
- this.arrayRef[i].update
296
- ) {
297
- this.arrayRef[i].setScrollEnabled(false);
298
- }
75
+
76
+ // onBackPress = () => {
77
+ // this.hide();
78
+ // return true;
79
+ // }
80
+
81
+ componentDidMount() {
82
+ // BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
83
+ // BackHandler.addEventListener('hardwareBackPress', this.onBackPress);
84
+
85
+ // setTimeout(() => {
86
+ // BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
87
+ // BackHandler.addEventListener('hardwareBackPress', this.onBackPress);
88
+ // }, 200);
89
+
90
+ this.setStateMonth(this.dayIndex, this.monthIndex, this.yearIndex);
91
+ const { onCreateRef } = this.props;
92
+ if (typeof onCreateRef === 'function') onCreateRef(this);
299
93
  }
300
- };
301
-
302
- onEndDrag = refName => {
303
- // eslint-disable-next-line no-restricted-syntax
304
- for (const i in this.arrayRef) {
305
- if (
306
- i &&
307
- i !== refName &&
308
- this.arrayRef &&
309
- this.arrayRef[i] &&
310
- this.arrayRef[i].update
311
- ) {
312
- this.arrayRef[i].setScrollEnabled(true);
313
- }
94
+
95
+ componentWillUnmount() {
96
+ // BackHandler.removeEventListener('hardwareBackPress', this.onBackPress);
314
97
  }
315
- };
316
98
 
317
- show = () => {};
99
+ initDefault(props) {
100
+ if (props) {
101
+ const propsMinDate = props.minDate ? props.minDate : props.minValue;
102
+ const propsMaxDate = props.maxDate ? props.maxDate : props.maxValue;
103
+ const propsSelectedDate = props.selectedDate
104
+ ? props.selectedDate
105
+ : props.value;
106
+
107
+ if (propsMinDate) {
108
+ this.minDate = DatePickerHelper.formatDate(
109
+ propsMinDate,
110
+ props.format,
111
+ );
112
+ } else if (props.maxAge) {
113
+ this.minDate = DatePickerHelper.calculateDateSinceYearAgo(
114
+ props.maxAge,
115
+ );
116
+ } else {
117
+ this.minDate = null;
118
+ }
318
119
 
319
- hide = () => {
320
- const {onClose, requestClose} = this.props;
321
- if (requestClose && typeof requestClose === 'function') {
322
- requestClose(() => {
323
- if (onClose && typeof onClose === 'function') {
324
- onClose();
120
+ if (propsMaxDate) {
121
+ this.maxDate = DatePickerHelper.formatDate(
122
+ propsMaxDate,
123
+ props.format,
124
+ );
125
+ } else if (props.minAge) {
126
+ this.maxDate = DatePickerHelper.calculateDateSinceYearAgo(
127
+ props.minAge,
128
+ );
129
+ } else {
130
+ this.maxDate = null;
131
+ }
132
+
133
+ if (
134
+ this.maxDate &&
135
+ this.minDate &&
136
+ this.maxDate.getTime() < this.minDate.getTime()
137
+ ) {
138
+ this.maxDate = null;
139
+ this.minDate = null;
140
+ }
141
+
142
+ if (propsSelectedDate) {
143
+ this.selectedDate = DatePickerHelper.formatDate(
144
+ propsSelectedDate,
145
+ props.format,
146
+ );
147
+ if (this.selectedDate) {
148
+ if (
149
+ this.minDate &&
150
+ this.selectedDate.getTime() < this.minDate.getTime()
151
+ ) {
152
+ this.selectedDate = null;
153
+ } else if (
154
+ this.maxDate &&
155
+ this.maxDate.getTime() < this.selectedDate.getTime()
156
+ ) {
157
+ this.selectedDate = null;
158
+ }
159
+ }
160
+ } else {
161
+ this.selectedDate = null;
162
+ }
163
+ if (props.format === 'hh:mm') {
164
+ this.selectedDate = props.isRanged
165
+ ? {
166
+ from: DatePickerHelper.formatDate(
167
+ propsSelectedDate.from,
168
+ props.format,
169
+ ),
170
+ to: DatePickerHelper.formatDate(
171
+ propsSelectedDate.to,
172
+ props.format,
173
+ ),
174
+ }
175
+ : DatePickerHelper.formatDate(
176
+ propsSelectedDate,
177
+ props.format,
178
+ );
179
+ }
325
180
  }
326
- });
327
- }
328
- };
329
-
330
- finish = () => {
331
- const {format, onSelected, isRanged, selectedDate} = this.props;
332
- if (isRanged && format === 'hh:mm') {
333
- const from = this.ranged[this.hourRangeIndex_1];
334
- const to = this.ranged[this.hourRangeIndex_2];
335
-
336
- if (onSelected && typeof onSelected === 'function') {
337
- onSelected({
338
- from,
339
- to,
340
- });
341
- }
342
- this.hide();
343
- return;
344
- }
345
- const day = this.days[this.dayIndex];
346
- const month = this.months[this.monthIndex];
347
- const year = this.years[this.yearIndex];
348
- const hour = this.hours[this.hourIndex] || '00';
349
- const minute = this.minutes[this.minuteIndex] || '00';
350
- const selectedDateFormatted = DatePickerHelper.toString(
351
- day,
352
- month,
353
- year,
354
- hour,
355
- minute,
356
- format,
357
- );
358
- if (onSelected && typeof onSelected === 'function') {
359
- onSelected(
360
- selectedDateFormatted ||
361
- selectedDate ||
362
- DatePickerHelper.getCurrentDate(format),
363
- );
364
- }
365
- this.hide();
366
- };
367
-
368
- renderUpdate(param) {
369
- if (param && param.day != null) {
370
- this.dayIndex = param.day;
371
- this.updateWheelPiker('DayView', {
372
- arrayValue: this.days,
373
- value: param.day,
374
- });
181
+ this.createDataDate(
182
+ this.minDate,
183
+ this.maxDate,
184
+ props.minuteArray,
185
+ props.startTime,
186
+ props.endTime,
187
+ props.rangeHour,
188
+ );
189
+ this.selectedIndexDate();
375
190
  }
376
191
 
377
- if (param && param.month != null) {
378
- this.monthIndex = param.month;
379
- this.updateWheelPiker('MonthView', {
380
- arrayValue: this.months,
381
- value: param.month,
382
- });
192
+ createDataDate(
193
+ minDate,
194
+ maxDate,
195
+ minuteArray,
196
+ startTime,
197
+ endTime,
198
+ rangeHour,
199
+ ) {
200
+ this.minDay = 1;
201
+ this.minMonth = 1;
202
+ this.minYear = 1970;
203
+
204
+ this.maxDay = 31;
205
+ this.maxMonth = 12;
206
+ this.maxYear = 2100;
207
+ if (minDate) {
208
+ this.minDay = minDate.getDate();
209
+ this.minMonth = minDate.getMonth() + 1;
210
+ this.minYear = minDate.getFullYear();
211
+ }
212
+ if (maxDate) {
213
+ this.maxDay = maxDate.getDate();
214
+ this.maxMonth = maxDate.getMonth() + 1;
215
+ this.maxYear = maxDate.getFullYear();
216
+ }
217
+ this.days = DatePickerHelper.makeRange(1, 31);
218
+ this.months = DatePickerHelper.makeRange(1, 12);
219
+ this.years = DatePickerHelper.makeRange(this.minYear, this.maxYear);
220
+ this.hours = DatePickerHelper.makeRange(0, 23, true);
221
+ if (Array.isArray(minuteArray)) {
222
+ this.minutes = minuteArray;
223
+ } else {
224
+ this.minutes = DatePickerHelper.makeRange(0, 59, true);
225
+ }
226
+ this.ranged = rangeHour || DatePickerHelper.arrayRange;
227
+ this.startTime = startTime || DatePickerHelper.arrayRange;
228
+ this.endTime = endTime || DatePickerHelper.arrayRange;
383
229
  }
384
230
 
385
- if (param && param.year != null) {
386
- this.yearIndex = param.year;
387
- this.updateWheelPiker('YearView', {
388
- arrayValue: this.years,
389
- value: param.year,
390
- });
231
+ selectedIndexDate() {
232
+ const { format, isRanged } = this.props;
233
+ let current = new Date();
234
+ if (this.minDate && current.getTime() < this.minDate.getTime()) {
235
+ current = this.minDate;
236
+ } else if (this.maxDate && current.getTime() > this.maxDate.getTime()) {
237
+ current = this.maxDate;
238
+ }
239
+ if (format === 'hh:mm' && isRanged) {
240
+ const valueHours_1 = this.selectedDate?.from
241
+ ? `${getStrings(
242
+ this.selectedDate?.from?.getHours()?.toString(),
243
+ )}:${getStrings(
244
+ this.selectedDate?.from?.getMinutes()?.toString(),
245
+ )}`
246
+ : '00:00';
247
+ const valueHours_2 = this.selectedDate?.to
248
+ ? `${getStrings(
249
+ this.selectedDate?.to?.getHours()?.toString(),
250
+ )}:${getStrings(
251
+ this.selectedDate?.to?.getMinutes()?.toString(),
252
+ )}`
253
+ : '00:00';
254
+ this.hourRangeIndex_1 = valueHours_1
255
+ ? this.ranged.indexOf(valueHours_1)
256
+ : this.ranged.indexOf(
257
+ `${current.getHours().toString()}:${current
258
+ .getMinutes()
259
+ .toString()}`,
260
+ );
261
+
262
+ this.hourRangeIndex_2 = valueHours_2
263
+ ? this.ranged.indexOf(valueHours_2)
264
+ : this.ranged.indexOf(
265
+ `${current.getHours().toString()}:${current
266
+ .getMinutes()
267
+ .toString()}`,
268
+ );
269
+ return;
270
+ }
271
+ this.dayIndex = this.selectedDate
272
+ ? this.days.indexOf(this.selectedDate.getDate().toString())
273
+ : this.days.indexOf(current.getDate().toString());
274
+
275
+ this.monthIndex = this.selectedDate
276
+ ? this.months.indexOf((this.selectedDate.getMonth() + 1).toString())
277
+ : this.months.indexOf((current.getMonth() + 1).toString());
278
+
279
+ this.yearIndex = this.selectedDate
280
+ ? this.years.indexOf(this.selectedDate.getFullYear().toString())
281
+ : this.years.indexOf(current.getFullYear().toString());
282
+
283
+ if (format === 'hh:mm' && !isRanged) {
284
+ const valueHours = this.selectedDate
285
+ ? this.selectedDate?.getHours()?.toString()?.length === 1
286
+ ? `0${this.selectedDate.getHours().toString()}`
287
+ : this.selectedDate?.getHours()?.toString() || ''
288
+ : '';
289
+ const valueMinute = this.selectedDate
290
+ ? this.selectedDate?.getMinutes()?.toString()?.length === 1
291
+ ? `0${this.selectedDate.getMinutes().toString()}`
292
+ : this.selectedDate?.getMinutes()?.toString() || ''
293
+ : '';
294
+
295
+ this.hourIndex = this.selectedDate
296
+ ? this.hours.indexOf(valueHours)
297
+ : this.hours.indexOf(
298
+ current.getHours().toString().length === 1
299
+ ? `0${current.getHours().toString()}`
300
+ : current.getHours().toString(),
301
+ );
302
+
303
+ this.minuteIndex = this.selectedDate
304
+ ? this.minutes.indexOf(valueMinute)
305
+ : this.minutes.indexOf(
306
+ current.getMinutes().toString().length === 1
307
+ ? `0${current.getMinutes().toString()}`
308
+ : current.getMinutes().toString(),
309
+ );
310
+ }
391
311
  }
392
312
 
393
- if (param && param.hour != null) {
394
- this.hourIndex = param.hour;
395
- this.updateWheelPiker('HourView', {
396
- arrayValue: this.hours,
397
- value: param.hour,
398
- });
399
- }
313
+ onBeginDrag = (refName) => {
314
+ // eslint-disable-next-line no-restricted-syntax
315
+ for (const i in this.arrayRef) {
316
+ if (
317
+ i &&
318
+ i !== refName &&
319
+ this.arrayRef &&
320
+ this.arrayRef[i] &&
321
+ this.arrayRef[i].update
322
+ ) {
323
+ this.arrayRef[i].setScrollEnabled(false);
324
+ }
325
+ }
326
+ };
327
+
328
+ onEndDrag = (refName) => {
329
+ // eslint-disable-next-line no-restricted-syntax
330
+ for (const i in this.arrayRef) {
331
+ if (
332
+ i &&
333
+ i !== refName &&
334
+ this.arrayRef &&
335
+ this.arrayRef[i] &&
336
+ this.arrayRef[i].update
337
+ ) {
338
+ this.arrayRef[i].setScrollEnabled(true);
339
+ }
340
+ }
341
+ };
342
+
343
+ show = () => {};
344
+
345
+ hide = () => {
346
+ const { onClose, requestClose } = this.props;
347
+ if (requestClose && typeof requestClose === 'function') {
348
+ requestClose(() => {
349
+ if (onClose && typeof onClose === 'function') {
350
+ onClose();
351
+ }
352
+ });
353
+ }
354
+ };
355
+
356
+ finish = () => {
357
+ const { format, onSelected, isRanged, selectedDate } = this.props;
358
+ if (isRanged && format === 'hh:mm') {
359
+ const from = this.ranged[this.hourRangeIndex_1];
360
+ const to = this.ranged[this.hourRangeIndex_2];
361
+ if (onSelected && typeof onSelected === 'function') {
362
+ onSelected({ from, to });
363
+ }
364
+ this.hide();
365
+ return;
366
+ }
367
+ const day = this.days[this.dayIndex];
368
+ const month = this.months[this.monthIndex];
369
+ const year = this.years[this.yearIndex];
370
+ const hour = this.hours[this.hourIndex] || '00';
371
+ const minute = this.minutes[this.minuteIndex] || '00';
372
+ const selectedDateFormatted = DatePickerHelper.toString(
373
+ day,
374
+ month,
375
+ year,
376
+ hour,
377
+ minute,
378
+ format,
379
+ );
380
+ if (onSelected && typeof onSelected === 'function') {
381
+ onSelected(
382
+ selectedDateFormatted ||
383
+ selectedDate ||
384
+ DatePickerHelper.getCurrentDate(format),
385
+ );
386
+ }
387
+ this.hide();
388
+ };
389
+
390
+ renderUpdate(param) {
391
+ if (param && param.day != null) {
392
+ this.dayIndex = param.day;
393
+ this.updateWheelPiker('DayView', {
394
+ arrayValue: this.days,
395
+ value: param.day,
396
+ });
397
+ }
400
398
 
401
- if (param && param.minute != null) {
402
- this.minuteIndex = param.minute;
403
- this.updateWheelPiker('MinuteView', {
404
- arrayValue: this.minutes,
405
- value: param.minute,
406
- });
407
- }
399
+ if (param && param.month != null) {
400
+ this.monthIndex = param.month;
401
+ this.updateWheelPiker('MonthView', {
402
+ arrayValue: this.months,
403
+ value: param.month,
404
+ });
405
+ }
408
406
 
409
- if (param && param.hourRange_1 != null) {
410
- this.hourRangeIndex_1 = param.hourRange_1;
411
- this.updateWheelPiker('HourRange1', {
412
- arrayValue: this.ranged,
413
- value: param.hourRange_1,
414
- });
415
- }
407
+ if (param && param.year != null) {
408
+ this.yearIndex = param.year;
409
+ this.updateWheelPiker('YearView', {
410
+ arrayValue: this.years,
411
+ value: param.year,
412
+ });
413
+ }
416
414
 
417
- if (param && param.hourRange_2 != null) {
418
- this.hourRangeIndex_2 = param.hourRange_2;
419
- this.updateWheelPiker('HourRange2', {
420
- arrayValue: this.ranged,
421
- value: param.hourRange_2,
422
- });
423
- }
424
- }
415
+ if (param && param.hour != null) {
416
+ this.hourIndex = param.hour;
417
+ this.updateWheelPiker('HourView', {
418
+ arrayValue: this.hours,
419
+ value: param.hour,
420
+ });
421
+ }
425
422
 
426
- setStateDate(dayIndex, monthIndex, yearIndex) {
427
- const day = parseInt(this.days[dayIndex]);
428
- const month = parseInt(this.months[monthIndex]);
429
- const year = parseInt(this.years[yearIndex]);
423
+ if (param && param.minute != null) {
424
+ this.minuteIndex = param.minute;
425
+ this.updateWheelPiker('MinuteView', {
426
+ arrayValue: this.minutes,
427
+ value: param.minute,
428
+ });
429
+ }
430
430
 
431
- let isUpDate = false;
432
- let minDay = 1;
433
- let maxDay = DatePickerHelper.getMaxDate(month, year);
431
+ if (param && param.hourRange_1 != null) {
432
+ this.hourRangeIndex_1 = param.hourRange_1;
433
+ this.updateWheelPiker('HourRange1', {
434
+ arrayValue: this.ranged,
435
+ value: param.hourRange_1,
436
+ });
437
+ }
434
438
 
435
- if (this.maxDay && year === this.maxYear && this.maxMonth === month) {
436
- maxDay = this.maxDay;
439
+ if (param && param.hourRange_2 != null) {
440
+ this.hourRangeIndex_2 = param.hourRange_2;
441
+ this.updateWheelPiker('HourRange2', {
442
+ arrayValue: this.ranged,
443
+ value: param.hourRange_2,
444
+ });
445
+ }
437
446
  }
438
447
 
439
- if (this.minDay && year === this.minYear && this.minMonth === month) {
440
- minDay = this.minDay;
441
- }
448
+ setStateDate(dayIndex, monthIndex, yearIndex) {
449
+ const day = parseInt(this.days[dayIndex]);
450
+ const month = parseInt(this.months[monthIndex]);
451
+ const year = parseInt(this.years[yearIndex]);
442
452
 
443
- if (maxDay !== this.days?.length || minDay !== parseInt(this.days[0])) {
444
- isUpDate = true;
445
- }
453
+ let isUpDate = false;
454
+ let minDay = 1;
455
+ let maxDay = DatePickerHelper.getMaxDate(month, year);
446
456
 
447
- let index = dayIndex;
457
+ if (this.maxDay && year === this.maxYear && this.maxMonth === month) {
458
+ maxDay = this.maxDay;
459
+ }
448
460
 
449
- if (isUpDate) {
450
- this.days = DatePickerHelper.makeRange(minDay, maxDay);
451
- index =
452
- day > maxDay
453
- ? this.days?.length - 1
454
- : day < minDay
455
- ? 0
456
- : this.days.indexOf(day.toString());
457
- }
461
+ if (this.minDay && year === this.minYear && this.minMonth === month) {
462
+ minDay = this.minDay;
463
+ }
464
+
465
+ if (maxDay !== this.days?.length || minDay !== parseInt(this.days[0])) {
466
+ isUpDate = true;
467
+ }
468
+
469
+ let index = dayIndex;
470
+
471
+ if (isUpDate) {
472
+ this.days = DatePickerHelper.makeRange(minDay, maxDay);
473
+ index =
474
+ day > maxDay
475
+ ? this.days?.length - 1
476
+ : day < minDay
477
+ ? 0
478
+ : this.days.indexOf(day.toString());
479
+ }
458
480
 
459
- this.renderUpdate({
460
- day: index,
461
- month: monthIndex,
462
- year: yearIndex,
463
- });
464
- }
481
+ this.renderUpdate({
482
+ day: index,
483
+ month: monthIndex,
484
+ year: yearIndex,
485
+ });
486
+ }
465
487
 
466
- setStateMonth(dayIndex, monthIndex, yearIndex) {
467
- const month = parseInt(this.months[monthIndex]);
468
- const year = parseInt(this.years[yearIndex]);
488
+ setStateMonth(dayIndex, monthIndex, yearIndex) {
489
+ const month = parseInt(this.months[monthIndex]);
490
+ const year = parseInt(this.years[yearIndex]);
469
491
 
470
- let isUpDate = false;
471
- let minMonth = 1;
472
- let maxMonth = 12;
492
+ let isUpDate = false;
493
+ let minMonth = 1;
494
+ let maxMonth = 12;
473
495
 
474
- if (this.maxMonth && year === this.maxYear) {
475
- maxMonth = this.maxMonth;
496
+ if (this.maxMonth && year === this.maxYear) {
497
+ maxMonth = this.maxMonth;
498
+ }
499
+ if (this.minMonth && year === this.minYear) {
500
+ minMonth = this.minMonth;
501
+ }
502
+ if (
503
+ maxMonth !== this.months?.length ||
504
+ minMonth !== parseInt(this.months[0])
505
+ ) {
506
+ isUpDate = true;
507
+ }
508
+ let index = monthIndex;
509
+ if (isUpDate) {
510
+ this.months = DatePickerHelper.makeRange(minMonth, maxMonth);
511
+ index =
512
+ month > maxMonth
513
+ ? this.months?.length - 1
514
+ : month < minMonth
515
+ ? 0
516
+ : this.months?.indexOf(month.toString());
517
+ }
518
+ this.setStateDate(dayIndex, index, yearIndex);
476
519
  }
477
- if (this.minMonth && year === this.minYear) {
478
- minMonth = this.minMonth;
520
+
521
+ updateWheelPiker(refName, param) {
522
+ let refWheelPicker;
523
+ if (this.arrayRef) {
524
+ refWheelPicker = this.arrayRef[refName];
525
+ if (refWheelPicker && refWheelPicker.update) {
526
+ this.arrayRef[refName].update(param);
527
+ }
528
+ }
479
529
  }
480
- if (
481
- maxMonth !== this.months?.length ||
482
- minMonth !== parseInt(this.months[0])
530
+
531
+ renderColumn(
532
+ refName,
533
+ valueInput,
534
+ arrayValue,
535
+ label,
536
+ bottomOffset,
537
+ callback,
538
+ reversePreFix,
483
539
  ) {
484
- isUpDate = true;
540
+ if (!this.arrayRef) {
541
+ this.arrayRef = {};
542
+ }
543
+ return (
544
+ <WheelPicker
545
+ bottomOffset={bottomOffset}
546
+ key={refName}
547
+ refName={refName}
548
+ ref={(ref) => {
549
+ this.arrayRef[refName] = ref;
550
+ }}
551
+ value={valueInput}
552
+ arrayValue={arrayValue}
553
+ reversePreFix={reversePreFix}
554
+ preFix={label}
555
+ onBeginDrag={this.onBeginDrag}
556
+ onEndDrag={this.onEndDrag}
557
+ onValueChange={(value) => {
558
+ if (callback) {
559
+ callback(value);
560
+ }
561
+ }}
562
+ />
563
+ );
485
564
  }
486
- let index = monthIndex;
487
- if (isUpDate) {
488
- this.months = DatePickerHelper.makeRange(minMonth, maxMonth);
489
- index =
490
- month > maxMonth
491
- ? this.months?.length - 1
492
- : month < minMonth
493
- ? 0
494
- : this.months?.indexOf(month.toString());
565
+
566
+ renderHeader() {
567
+ const {
568
+ title,
569
+ placeholder,
570
+ body,
571
+ buttonTitle,
572
+ onButtonPress,
573
+ headerStyle,
574
+ iconClosePosition = 'right',
575
+ iconType,
576
+ headerButtonStyle,
577
+ } = this.props;
578
+ return (
579
+ <BottomPopupHeader
580
+ iconType={iconType}
581
+ iconClosePosition={iconClosePosition}
582
+ body={body}
583
+ onClose={this.hide}
584
+ title={title || placeholder}
585
+ buttonTitle={buttonTitle}
586
+ onButtonPress={onButtonPress}
587
+ style={[styles.header, headerStyle]}
588
+ headerButtonStyle={headerButtonStyle}
589
+ />
590
+ );
495
591
  }
496
- this.setStateDate(dayIndex, index, yearIndex);
497
- }
498
-
499
- updateWheelPiker(refName, param) {
500
- let refWheelPicker;
501
- if (this.arrayRef) {
502
- refWheelPicker = this.arrayRef[refName];
503
- if (refWheelPicker && refWheelPicker.update) {
504
- this.arrayRef[refName].update(param);
505
- }
592
+
593
+ renderDescription = () => {
594
+ const { description, descriptionStyle, renderDescription } = this.props;
595
+ if (renderDescription) return renderDescription;
596
+ return description ? (
597
+ <Text.Title style={[{ marginBottom: Spacing.S }, descriptionStyle]}>
598
+ {description}
599
+ </Text.Title>
600
+ ) : null;
601
+ };
602
+
603
+ renderContent() {
604
+ const {
605
+ format,
606
+ labelDay,
607
+ labelMonth,
608
+ labelYear,
609
+ bottomOffset,
610
+ labelMinute,
611
+ labelHour,
612
+ isRanged,
613
+ } = this.props;
614
+ if (isRanged && format === 'hh:mm') {
615
+ return (
616
+ <View style={styles.container}>
617
+ {this.renderDescription()}
618
+ <View style={styles.content}>
619
+ {this.renderColumn(
620
+ 'HourRange1',
621
+ this.hourRangeIndex_1,
622
+ this.startTime,
623
+ SwitchLanguage.from,
624
+ bottomOffset,
625
+ (value) => {
626
+ this.renderUpdate({ hourRange_1: value });
627
+ },
628
+ true,
629
+ )}
630
+ {this.renderColumn(
631
+ 'HourRange2',
632
+ this.hourRangeIndex_2,
633
+ this.endTime,
634
+ SwitchLanguage.to,
635
+ bottomOffset,
636
+ (value) => {
637
+ this.renderUpdate({ hourRange_2: value });
638
+ },
639
+ true,
640
+ )}
641
+ </View>
642
+ </View>
643
+ );
644
+ }
645
+ return (
646
+ <View style={styles.container}>
647
+ {this.renderDescription()}
648
+ <View style={styles.content}>
649
+ {format.indexOf('dd') !== -1
650
+ ? this.renderColumn(
651
+ 'DayView',
652
+ this.dayIndex,
653
+ this.days,
654
+ labelDay || SwitchLanguage.day,
655
+ bottomOffset,
656
+ (value) => {
657
+ this.renderUpdate({ day: value });
658
+ },
659
+ )
660
+ : null}
661
+ {format.indexOf('MM') !== -1
662
+ ? this.renderColumn(
663
+ 'MonthView',
664
+ this.monthIndex,
665
+ this.months,
666
+ labelMonth || SwitchLanguage.month,
667
+ bottomOffset,
668
+ (value) => {
669
+ this.setStateDate(
670
+ this.dayIndex,
671
+ value,
672
+ this.yearIndex,
673
+ );
674
+ },
675
+ )
676
+ : null}
677
+ {format.indexOf('YYYY') !== -1
678
+ ? this.renderColumn(
679
+ 'YearView',
680
+ this.yearIndex,
681
+ this.years,
682
+ labelYear || SwitchLanguage.year,
683
+ bottomOffset,
684
+ (value) => {
685
+ this.setStateMonth(
686
+ this.dayIndex,
687
+ this.monthIndex,
688
+ value,
689
+ );
690
+ },
691
+ )
692
+ : null}
693
+ {format.indexOf('hh') !== -1
694
+ ? this.renderColumn(
695
+ 'HourView',
696
+ this.hourIndex,
697
+ this.hours,
698
+ labelHour || SwitchLanguage.hour,
699
+ bottomOffset,
700
+ (value) => {
701
+ this.renderUpdate({ hour: value });
702
+ },
703
+ true,
704
+ )
705
+ : null}
706
+ {format.indexOf('mm') !== -1
707
+ ? this.renderColumn(
708
+ 'MinuteView',
709
+ this.minuteIndex,
710
+ this.minutes,
711
+ labelMinute || SwitchLanguage.minute,
712
+ bottomOffset,
713
+ (value) => {
714
+ this.renderUpdate({ minute: value });
715
+ },
716
+ true,
717
+ )
718
+ : null}
719
+ </View>
720
+ </View>
721
+ );
506
722
  }
507
- }
508
-
509
- renderColumn(
510
- refName,
511
- valueInput,
512
- arrayValue,
513
- label,
514
- bottomOffset,
515
- callback,
516
- reversePreFix,
517
- ) {
518
- if (!this.arrayRef) {
519
- this.arrayRef = {};
723
+
724
+ renderFooter() {
725
+ const { titleFooter, renderFooter, footerButtonStyle } = this.props;
726
+ return renderFooter ? (
727
+ renderFooter()
728
+ ) : (
729
+ <View
730
+ style={{
731
+ paddingHorizontal: 12,
732
+ marginBottom: ifIphoneX(35, 12),
733
+ marginTop: 16,
734
+ }}>
735
+ <Button
736
+ onPress={this.finish}
737
+ buttonStyle={[footerButtonStyle]}
738
+ title={titleFooter || SwitchLanguage.confirm}
739
+ type="primary"
740
+ />
741
+ </View>
742
+ );
520
743
  }
521
- return (
522
- <WheelPicker
523
- bottomOffset={bottomOffset}
524
- key={refName}
525
- refName={refName}
526
- ref={ref => {
527
- this.arrayRef[refName] = ref;
528
- }}
529
- value={valueInput}
530
- arrayValue={arrayValue}
531
- reversePreFix={reversePreFix}
532
- preFix={label}
533
- onBeginDrag={this.onBeginDrag}
534
- onEndDrag={this.onEndDrag}
535
- onValueChange={value => {
536
- if (callback) {
537
- callback(value);
538
- }
539
- }}
540
- />
541
- );
542
- }
543
-
544
- renderHeader() {
545
- const {
546
- title,
547
- placeholder,
548
- body,
549
- buttonTitle,
550
- onButtonPress,
551
- headerStyle,
552
- iconClosePosition = 'right',
553
- iconType,
554
- headerButtonStyle,
555
- } = this.props;
556
- return (
557
- <BottomPopupHeader
558
- iconType={iconType}
559
- iconClosePosition={iconClosePosition}
560
- body={body}
561
- onClose={this.hide}
562
- title={title || placeholder}
563
- buttonTitle={buttonTitle}
564
- onButtonPress={onButtonPress}
565
- style={[styles.header, headerStyle]}
566
- headerButtonStyle={headerButtonStyle}
567
- />
568
- );
569
- }
570
-
571
- renderDescription = () => {
572
- const {description, descriptionStyle, renderDescription} = this.props;
573
- if (renderDescription) return renderDescription;
574
- return description ? (
575
- <Text.Paragraph style={[{marginBottom: Spacing.S}, descriptionStyle]}>
576
- {description}
577
- </Text.Paragraph>
578
- ) : null;
579
- };
580
-
581
- renderContent() {
582
- const {
583
- format,
584
- labelDay,
585
- labelMonth,
586
- labelYear,
587
- bottomOffset,
588
- labelMinute,
589
- labelHour,
590
- isRanged,
591
- } = this.props;
592
-
593
- if (isRanged && format === 'hh:mm') {
594
- return (
595
- <View style={styles.container}>
596
- {this.renderDescription()}
597
- <View style={styles.content}>
598
- {this.renderColumn(
599
- 'HourRange1',
600
- this.hourRangeIndex_1,
601
- this.ranged,
602
- SwitchLanguage.from,
603
- bottomOffset,
604
- value => {
605
- this.renderUpdate({hourRange_1: value});
606
- },
607
- true,
608
- )}
609
- {this.renderColumn(
610
- 'HourRange2',
611
- this.hourRangeIndex_2,
612
- this.ranged,
613
- SwitchLanguage.to,
614
- bottomOffset,
615
- value => {
616
- this.renderUpdate({hourRange_2: value});
617
- },
618
- true,
619
- )}
620
- </View>
621
- </View>
622
- );
744
+
745
+ render() {
746
+ const { style } = this.props;
747
+ return (
748
+ <View style={[styles.view, style]}>
749
+ {this.renderHeader()}
750
+ {this.renderContent()}
751
+ {this.renderFooter()}
752
+ </View>
753
+ );
623
754
  }
624
- return (
625
- <View style={styles.container}>
626
- {this.renderDescription()}
627
- <View style={styles.content}>
628
- {format.indexOf('dd') !== -1
629
- ? this.renderColumn(
630
- 'DayView',
631
- this.dayIndex,
632
- this.days,
633
- labelDay || SwitchLanguage.day,
634
- bottomOffset,
635
- value => {
636
- this.renderUpdate({day: value});
637
- },
638
- )
639
- : null}
640
- {format.indexOf('MM') !== -1
641
- ? this.renderColumn(
642
- 'MonthView',
643
- this.monthIndex,
644
- this.months,
645
- labelMonth || SwitchLanguage.month,
646
- bottomOffset,
647
- value => {
648
- this.setStateDate(this.dayIndex, value, this.yearIndex);
649
- },
650
- )
651
- : null}
652
- {format.indexOf('YYYY') !== -1
653
- ? this.renderColumn(
654
- 'YearView',
655
- this.yearIndex,
656
- this.years,
657
- labelYear || SwitchLanguage.year,
658
- bottomOffset,
659
- value => {
660
- this.setStateMonth(this.dayIndex, this.monthIndex, value);
661
- },
662
- )
663
- : null}
664
- {format.indexOf('hh') !== -1
665
- ? this.renderColumn(
666
- 'HourView',
667
- this.hourIndex,
668
- this.hours,
669
- labelHour || SwitchLanguage.hour,
670
- bottomOffset,
671
- value => {
672
- this.renderUpdate({hour: value});
673
- },
674
- true,
675
- )
676
- : null}
677
- {format.indexOf('mm') !== -1
678
- ? this.renderColumn(
679
- 'MinuteView',
680
- this.minuteIndex,
681
- this.minutes,
682
- labelMinute || SwitchLanguage.minute,
683
- bottomOffset,
684
- value => {
685
- this.renderUpdate({minute: value});
686
- },
687
- true,
688
- )
689
- : null}
690
- </View>
691
- </View>
692
- );
693
- }
694
-
695
- renderFooter() {
696
- const {titleFooter, renderFooter, footerButtonStyle} = this.props;
697
- return renderFooter ? (
698
- renderFooter()
699
- ) : (
700
- <View
701
- style={{
702
- paddingHorizontal: 12,
703
- marginBottom: ifIphoneX(35, 12),
704
- marginTop: 16,
705
- }}>
706
- <Button
707
- onPress={this.finish}
708
- buttonStyle={[footerButtonStyle]}
709
- title={titleFooter || SwitchLanguage.confirm}
710
- type="primary"
711
- />
712
- </View>
713
- );
714
- }
715
-
716
- render() {
717
- const {style} = this.props;
718
- return (
719
- <View style={[styles.view, style]}>
720
- {this.renderHeader()}
721
- {this.renderContent()}
722
- {this.renderFooter()}
723
- </View>
724
- );
725
- }
726
755
  }
727
756
 
728
757
  DatePicker.propTypes = {
729
- selectedDate: PropTypes.any,
730
- format: PropTypes.string,
731
- placeholder: PropTypes.string,
732
- minDate: PropTypes.string,
733
- maxDate: PropTypes.string,
734
- titleFooter: PropTypes.string,
735
- title: PropTypes.string,
736
- // titleCancel: PropTypes.string,
737
- // titleConfirm: PropTypes.string,
738
- labelMonth: PropTypes.string,
739
- labelHour: PropTypes.string,
740
- labelMinute: PropTypes.string,
741
- labelDay: PropTypes.string,
742
- labelYear: PropTypes.string,
743
- onSelected: PropTypes.func,
744
- bottomOffset: PropTypes.number,
745
- renderDescription: PropTypes.any,
746
- description: PropTypes.string,
747
- renderFooter: PropTypes.any,
748
- style: PropTypes.any,
749
- rangeHour: PropTypes.array,
750
- iconClosePosition: PropTypes.oneOf(['left', 'right']),
751
- iconType: PropTypes.oneOf(['icon', 'text']),
752
- startTime: PropTypes.array,
753
- endTime: PropTypes.array,
758
+ selectedDate: PropTypes.any,
759
+ format: PropTypes.string,
760
+ placeholder: PropTypes.string,
761
+ minDate: PropTypes.string,
762
+ maxDate: PropTypes.string,
763
+ titleFooter: PropTypes.string,
764
+ title: PropTypes.string,
765
+ // titleCancel: PropTypes.string,
766
+ // titleConfirm: PropTypes.string,
767
+ labelMonth: PropTypes.string,
768
+ labelHour: PropTypes.string,
769
+ labelMinute: PropTypes.string,
770
+ labelDay: PropTypes.string,
771
+ labelYear: PropTypes.string,
772
+ onSelected: PropTypes.func,
773
+ bottomOffset: PropTypes.number,
774
+ renderDescription: PropTypes.any,
775
+ description: PropTypes.string,
776
+ renderFooter: PropTypes.any,
777
+ style: PropTypes.any,
778
+ rangeHour: PropTypes.array,
779
+ iconClosePosition: PropTypes.oneOf(['left', 'right']),
780
+ iconType: PropTypes.oneOf(['icon', 'text']),
781
+ startTime: PropTypes.array,
782
+ endTime: PropTypes.array,
754
783
  };
755
784
 
756
785
  DatePicker.defaultProps = {
757
- format: 'dd/MM/YYYY',
758
- placeholder: SwitchLanguage.chooseDate,
759
- minDate: '1/1/1970',
760
- // titleCancel: SwitchLanguage.cancel,
761
- // titleConfirm: SwitchLanguage.done,
762
- // labelMonth: SwitchLanguage.month,
763
- // labelDay: SwitchLanguage.day,
764
- // labelYear: SwitchLanguage.year,
765
- // labelHour: SwitchLanguage.hour,
766
- // labelMinute: SwitchLanguage.minute,
767
- bottomOffset: 0,
786
+ format: 'dd/MM/YYYY',
787
+ placeholder: SwitchLanguage.chooseDate,
788
+ minDate: '1/1/1970',
789
+ // titleCancel: SwitchLanguage.cancel,
790
+ // titleConfirm: SwitchLanguage.done,
791
+ // labelMonth: SwitchLanguage.month,
792
+ // labelDay: SwitchLanguage.day,
793
+ // labelYear: SwitchLanguage.year,
794
+ // labelHour: SwitchLanguage.hour,
795
+ // labelMinute: SwitchLanguage.minute,
796
+ bottomOffset: 0,
768
797
  };
769
798
 
770
799
  export default DatePicker;