@izonnet-web-solution/react-native-date-time-picker-kit 1.0.0 → 1.0.1

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.
Files changed (58) hide show
  1. package/README.md +139 -19
  2. package/lib/module/components/CalendarPicker.js +12 -7
  3. package/lib/module/components/CalendarPicker.js.map +1 -1
  4. package/lib/module/components/DatePicker.js +21 -14
  5. package/lib/module/components/DatePicker.js.map +1 -1
  6. package/lib/module/components/DateRangePicker.js +10 -6
  7. package/lib/module/components/DateRangePicker.js.map +1 -1
  8. package/lib/module/components/DateTimePicker.js +115 -39
  9. package/lib/module/components/DateTimePicker.js.map +1 -1
  10. package/lib/module/components/TimePicker.js +7 -5
  11. package/lib/module/components/TimePicker.js.map +1 -1
  12. package/lib/module/components/WheelPicker.js +62 -41
  13. package/lib/module/components/WheelPicker.js.map +1 -1
  14. package/lib/module/components/common/ModalWrapper.js +8 -2
  15. package/lib/module/components/common/ModalWrapper.js.map +1 -1
  16. package/lib/module/localization/useLocale.js +54 -4
  17. package/lib/module/localization/useLocale.js.map +1 -1
  18. package/lib/module/theme/useTheme.js +23 -1
  19. package/lib/module/theme/useTheme.js.map +1 -1
  20. package/lib/module/utils/dateConversion.js +109 -0
  21. package/lib/module/utils/dateConversion.js.map +1 -1
  22. package/lib/typescript/src/components/CalendarPicker.d.ts +16 -0
  23. package/lib/typescript/src/components/CalendarPicker.d.ts.map +1 -1
  24. package/lib/typescript/src/components/DatePicker.d.ts +13 -1
  25. package/lib/typescript/src/components/DatePicker.d.ts.map +1 -1
  26. package/lib/typescript/src/components/DateRangePicker.d.ts +16 -1
  27. package/lib/typescript/src/components/DateRangePicker.d.ts.map +1 -1
  28. package/lib/typescript/src/components/DateTimePicker.d.ts.map +1 -1
  29. package/lib/typescript/src/components/TimePicker.d.ts +7 -1
  30. package/lib/typescript/src/components/TimePicker.d.ts.map +1 -1
  31. package/lib/typescript/src/components/WheelPicker.d.ts.map +1 -1
  32. package/lib/typescript/src/components/common/ModalWrapper.d.ts +1 -0
  33. package/lib/typescript/src/components/common/ModalWrapper.d.ts.map +1 -1
  34. package/lib/typescript/src/localization/useLocale.d.ts +1 -1
  35. package/lib/typescript/src/localization/useLocale.d.ts.map +1 -1
  36. package/lib/typescript/src/theme/types.d.ts +11 -0
  37. package/lib/typescript/src/theme/types.d.ts.map +1 -1
  38. package/lib/typescript/src/theme/useTheme.d.ts.map +1 -1
  39. package/lib/typescript/src/types/presentation.d.ts +7 -0
  40. package/lib/typescript/src/types/presentation.d.ts.map +1 -1
  41. package/lib/typescript/src/types/props.d.ts +154 -1
  42. package/lib/typescript/src/types/props.d.ts.map +1 -1
  43. package/lib/typescript/src/utils/dateConversion.d.ts +19 -0
  44. package/lib/typescript/src/utils/dateConversion.d.ts.map +1 -1
  45. package/package.json +16 -8
  46. package/src/components/CalendarPicker.tsx +38 -8
  47. package/src/components/DatePicker.tsx +45 -15
  48. package/src/components/DateRangePicker.tsx +31 -6
  49. package/src/components/DateTimePicker.tsx +217 -51
  50. package/src/components/TimePicker.tsx +18 -5
  51. package/src/components/WheelPicker.tsx +86 -56
  52. package/src/components/common/ModalWrapper.tsx +9 -1
  53. package/src/localization/useLocale.ts +64 -4
  54. package/src/theme/types.ts +12 -0
  55. package/src/theme/useTheme.ts +24 -1
  56. package/src/types/presentation.ts +7 -0
  57. package/src/types/props.ts +198 -11
  58. package/src/utils/dateConversion.ts +146 -0
@@ -30,7 +30,10 @@ export interface DateRangePickerRef {
30
30
  reset: () => void;
31
31
  }
32
32
 
33
- export interface DateRangePickerProps extends BaseModalProps {
33
+ export interface DateRangePickerProps extends Omit<
34
+ BaseModalProps,
35
+ 'onConfirm'
36
+ > {
34
37
  presentation?: PresentationMode;
35
38
  startDate?: Date | null;
36
39
  endDate?: Date | null;
@@ -38,8 +41,20 @@ export interface DateRangePickerProps extends BaseModalProps {
38
41
  defaultEndDate?: Date | null;
39
42
  onChange?: (range: DateRange) => void;
40
43
  onConfirmRange?: (range: { startDate: Date; endDate: Date }) => void;
44
+ /**
45
+ * Alias for `onConfirmRange`.
46
+ */
47
+ onConfirm?: (range: { startDate: Date; endDate: Date }) => void;
41
48
  minimumDate?: Date | string | number;
49
+ /**
50
+ * Alias for `minimumDate`.
51
+ */
52
+ minDate?: Date | string | number;
42
53
  maximumDate?: Date | string | number;
54
+ /**
55
+ * Alias for `maximumDate`.
56
+ */
57
+ maxDate?: Date | string | number;
43
58
  disabledDates?: (Date | string)[];
44
59
  disabledWeekdays?: number[];
45
60
  markedDates?: MarkedDatesMap;
@@ -85,9 +100,14 @@ export const DateRangePicker = forwardRef<
85
100
  showHandle,
86
101
  closeOnBackdropPress,
87
102
  testID,
103
+ ...restProps
88
104
  },
89
105
  ref
90
106
  ) => {
107
+ const effectiveMin = minimumDate ?? restProps.minDate;
108
+ const effectiveMax = maximumDate ?? restProps.maxDate;
109
+ const effectiveOnConfirm = onConfirmRange ?? restProps.onConfirm;
110
+
91
111
  const theme = useTheme(propTheme);
92
112
  const locale = useLocale(propLocale);
93
113
 
@@ -98,7 +118,12 @@ export const DateRangePicker = forwardRef<
98
118
  });
99
119
  const [activePresetId, setActivePresetId] = useState<string | undefined>();
100
120
 
101
- const modalVisible = propVisible !== undefined ? propVisible : isVisible;
121
+ const modalVisible =
122
+ restProps.isVisible !== undefined
123
+ ? restProps.isVisible
124
+ : propVisible !== undefined
125
+ ? propVisible
126
+ : isVisible;
102
127
 
103
128
  useImperativeHandle(ref, () => ({
104
129
  open: () => setIsVisible(true),
@@ -143,14 +168,14 @@ export const DateRangePicker = forwardRef<
143
168
 
144
169
  const handleConfirm = useCallback(() => {
145
170
  if (range.startDate && range.endDate) {
146
- onConfirmRange?.({
171
+ effectiveOnConfirm?.({
147
172
  startDate: range.startDate,
148
173
  endDate: range.endDate,
149
174
  });
150
175
  }
151
176
  setIsVisible(false);
152
177
  onClose?.();
153
- }, [range, onConfirmRange, onClose]);
178
+ }, [range, effectiveOnConfirm, onClose]);
154
179
 
155
180
  const handleCancel = useCallback(() => {
156
181
  onCancel?.();
@@ -187,8 +212,8 @@ export const DateRangePicker = forwardRef<
187
212
  startDate={range.startDate}
188
213
  endDate={range.endDate}
189
214
  onRangeChange={handleRangeChange}
190
- minimumDate={minimumDate}
191
- maximumDate={maximumDate}
215
+ minimumDate={effectiveMin}
216
+ maximumDate={effectiveMax}
192
217
  disabledDates={disabledDates}
193
218
  disabledWeekdays={disabledWeekdays}
194
219
  markedDates={markedDates}
@@ -23,7 +23,10 @@ import type {
23
23
  OpenPickerOptions,
24
24
  } from '../types';
25
25
  import {
26
+ clampDate,
27
+ clampTime,
26
28
  dateToTimestamp,
29
+ normalizeDateWithTimezone,
27
30
  parseDate,
28
31
  timestampToDate,
29
32
  } from '../utils/dateConversion';
@@ -83,11 +86,48 @@ export const DateTimePicker = forwardRef<
83
86
  testID,
84
87
  } = props;
85
88
 
86
- // Track internal date state
87
- const initialDate = useMemo(
88
- () => parseDate(propValue) || parseDate(defaultValue) || new Date(),
89
- [propValue, defaultValue]
90
- );
89
+ const effectiveMinDate = minimumDate ?? props.minDate;
90
+ const effectiveMaxDate = maximumDate ?? props.maxDate;
91
+ const effectiveTimeZone = props.timeZone ?? props.timeZoneName;
92
+ const effectiveOffsetMinutes =
93
+ timeZoneOffsetInMinutes !== undefined
94
+ ? timeZoneOffsetInMinutes
95
+ : props.utcOffset !== undefined
96
+ ? Math.abs(props.utcOffset) <= 14
97
+ ? props.utcOffset * 60
98
+ : props.utcOffset
99
+ : undefined;
100
+
101
+ const effectiveOpen =
102
+ propOpen !== undefined
103
+ ? propOpen
104
+ : props.isVisible !== undefined
105
+ ? props.isVisible
106
+ : props.visible !== undefined
107
+ ? props.visible
108
+ : undefined;
109
+
110
+ // Track internal date state with bounds clamping and timezone normalization
111
+ const initialDate = useMemo(() => {
112
+ let d = parseDate(propValue) || parseDate(defaultValue) || new Date();
113
+ if (effectiveTimeZone || effectiveOffsetMinutes !== undefined) {
114
+ d = normalizeDateWithTimezone(
115
+ d,
116
+ effectiveTimeZone,
117
+ effectiveOffsetMinutes
118
+ );
119
+ }
120
+ const clamped = clampDate(d, effectiveMinDate, effectiveMaxDate);
121
+ return clamped ? clampTime(clamped, effectiveMinDate, effectiveMaxDate) : d;
122
+ }, [
123
+ propValue,
124
+ defaultValue,
125
+ effectiveTimeZone,
126
+ effectiveOffsetMinutes,
127
+ effectiveMinDate,
128
+ effectiveMaxDate,
129
+ ]);
130
+
91
131
  const [currentDate, setCurrentDate] = useState<Date>(initialDate);
92
132
  const isOpenRef = useRef<boolean>(false);
93
133
  const dateRef = useRef<Date>(currentDate);
@@ -97,12 +137,44 @@ export const DateTimePicker = forwardRef<
97
137
  const [dateTimeTab, setDateTimeTab] = useState<'date' | 'time'>('date');
98
138
  const [activePresetId, setActivePresetId] = useState<string | undefined>();
99
139
 
100
- // Theme & Locale
101
- const resolvedTheme: ResolvedTheme = useTheme(
102
- typeof propTheme === 'object'
103
- ? propTheme
104
- : ({ mode: propTheme } as ThemeConfig)
105
- );
140
+ // Theme & Locale with custom overrides
141
+ const themeInput = useMemo(() => {
142
+ let base: ThemeConfig =
143
+ typeof propTheme === 'object'
144
+ ? { ...propTheme }
145
+ : ({ mode: propTheme } as ThemeConfig);
146
+
147
+ if (props.themeColors) {
148
+ base = {
149
+ ...base,
150
+ themeColors: {
151
+ ...base.themeColors,
152
+ ...props.themeColors,
153
+ },
154
+ };
155
+ }
156
+ if (accentColor || textColor || backgroundColor) {
157
+ base = {
158
+ ...base,
159
+ colors: {
160
+ ...base.colors,
161
+ ...(accentColor && {
162
+ accent: accentColor,
163
+ primary: accentColor,
164
+ selected: accentColor,
165
+ }),
166
+ ...(textColor && { text: textColor }),
167
+ ...(backgroundColor && {
168
+ background: backgroundColor,
169
+ modalBackground: backgroundColor,
170
+ }),
171
+ },
172
+ };
173
+ }
174
+ return base;
175
+ }, [propTheme, props.themeColors, accentColor, textColor, backgroundColor]);
176
+
177
+ const resolvedTheme: ResolvedTheme = useTheme(themeInput);
106
178
  const localeData = useLocale(propLocale);
107
179
 
108
180
  // Keep dateRef synced
@@ -113,21 +185,38 @@ export const DateTimePicker = forwardRef<
113
185
  // Update if propValue changes
114
186
  useEffect(() => {
115
187
  if (propValue !== undefined && propValue !== null) {
116
- const parsed = parseDate(propValue);
188
+ let parsed = parseDate(propValue);
117
189
  if (parsed) {
118
- setCurrentDate(parsed);
119
- dateRef.current = parsed;
190
+ if (effectiveTimeZone || effectiveOffsetMinutes !== undefined) {
191
+ parsed = normalizeDateWithTimezone(
192
+ parsed,
193
+ effectiveTimeZone,
194
+ effectiveOffsetMinutes
195
+ );
196
+ }
197
+ const clamped = clampDate(parsed, effectiveMinDate, effectiveMaxDate);
198
+ const finalDate = clamped
199
+ ? clampTime(clamped, effectiveMinDate, effectiveMaxDate)
200
+ : parsed;
201
+ setCurrentDate(finalDate);
202
+ dateRef.current = finalDate;
120
203
  }
121
204
  }
122
- }, [propValue]);
205
+ }, [
206
+ propValue,
207
+ effectiveTimeZone,
208
+ effectiveOffsetMinutes,
209
+ effectiveMinDate,
210
+ effectiveMaxDate,
211
+ ]);
123
212
 
124
213
  const buildNativeOptions = useCallback(
125
214
  (targetDate: Date): NativePickerOptions => {
126
- const minTimestamp = minimumDate
127
- ? dateToTimestamp(minimumDate)
215
+ const minTimestamp = effectiveMinDate
216
+ ? dateToTimestamp(effectiveMinDate)
128
217
  : undefined;
129
- const maxTimestamp = maximumDate
130
- ? dateToTimestamp(maximumDate)
218
+ const maxTimestamp = effectiveMaxDate
219
+ ? dateToTimestamp(effectiveMaxDate)
131
220
  : undefined;
132
221
 
133
222
  const nativeTheme: NativePickerTheme =
@@ -142,7 +231,7 @@ export const DateTimePicker = forwardRef<
142
231
  maximumDate: maxTimestamp ?? undefined,
143
232
  display,
144
233
  locale: typeof propLocale === 'string' ? propLocale : propLocale?.code,
145
- timeZoneOffsetInMinutes,
234
+ timeZoneOffsetInMinutes: effectiveOffsetMinutes,
146
235
  is24Hour,
147
236
  minuteInterval,
148
237
  title,
@@ -155,11 +244,11 @@ export const DateTimePicker = forwardRef<
155
244
  };
156
245
  },
157
246
  [
158
- minimumDate,
159
- maximumDate,
247
+ effectiveMinDate,
248
+ effectiveMaxDate,
160
249
  display,
161
250
  propLocale,
162
- timeZoneOffsetInMinutes,
251
+ effectiveOffsetMinutes,
163
252
  is24Hour,
164
253
  minuteInterval,
165
254
  title,
@@ -193,8 +282,8 @@ export const DateTimePicker = forwardRef<
193
282
  }
194
283
  }
195
284
 
196
- if (minimumDate && maximumDate) {
197
- if (!validateDateRange(minimumDate, maximumDate)) {
285
+ if (effectiveMinDate && effectiveMaxDate) {
286
+ if (!validateDateRange(effectiveMinDate, effectiveMaxDate)) {
198
287
  const err = new DateTimePickerError(
199
288
  'DATE_OUT_OF_RANGE',
200
289
  'minimumDate cannot be after maximumDate.'
@@ -290,8 +379,8 @@ export const DateTimePicker = forwardRef<
290
379
  }, [
291
380
  disabled,
292
381
  minuteInterval,
293
- minimumDate,
294
- maximumDate,
382
+ effectiveMinDate,
383
+ effectiveMaxDate,
295
384
  presentation,
296
385
  onOpen,
297
386
  buildNativeOptions,
@@ -409,13 +498,32 @@ export const DateTimePicker = forwardRef<
409
498
  return dateRef.current;
410
499
  }, []);
411
500
 
412
- const setValue = useCallback((date: Date | number | string) => {
413
- const parsed = parseDate(date);
414
- if (parsed) {
415
- setCurrentDate(parsed);
416
- dateRef.current = parsed;
417
- }
418
- }, []);
501
+ const setValue = useCallback(
502
+ (date: Date | number | string) => {
503
+ let parsed = parseDate(date);
504
+ if (parsed) {
505
+ if (effectiveTimeZone || effectiveOffsetMinutes !== undefined) {
506
+ parsed = normalizeDateWithTimezone(
507
+ parsed,
508
+ effectiveTimeZone,
509
+ effectiveOffsetMinutes
510
+ );
511
+ }
512
+ const clamped = clampDate(parsed, effectiveMinDate, effectiveMaxDate);
513
+ const finalDate = clamped
514
+ ? clampTime(clamped, effectiveMinDate, effectiveMaxDate)
515
+ : parsed;
516
+ setCurrentDate(finalDate);
517
+ dateRef.current = finalDate;
518
+ }
519
+ },
520
+ [
521
+ effectiveTimeZone,
522
+ effectiveOffsetMinutes,
523
+ effectiveMinDate,
524
+ effectiveMaxDate,
525
+ ]
526
+ );
419
527
 
420
528
  // Imperative handle
421
529
  useImperativeHandle(
@@ -442,12 +550,12 @@ export const DateTimePicker = forwardRef<
442
550
 
443
551
  // Declarative open prop support
444
552
  useEffect(() => {
445
- if (propOpen === true && !isOpenRef.current) {
553
+ if (effectiveOpen === true && !isOpenRef.current) {
446
554
  openPicker().catch(() => {});
447
- } else if (propOpen === false && isOpenRef.current) {
555
+ } else if (effectiveOpen === false && isOpenRef.current) {
448
556
  closePicker().catch(() => {});
449
557
  }
450
- }, [propOpen, openPicker, closePicker]);
558
+ }, [effectiveOpen, openPicker, closePicker]);
451
559
 
452
560
  // Presets handling
453
561
  const presets = useMemo(() => {
@@ -460,29 +568,87 @@ export const DateTimePicker = forwardRef<
460
568
  setActivePresetId(preset.id);
461
569
  const val = preset.getValue();
462
570
  if (val instanceof Date) {
463
- setCurrentDate(val);
464
- dateRef.current = val;
465
- onChange?.(val);
571
+ let updated = val;
572
+ if (effectiveTimeZone || effectiveOffsetMinutes !== undefined) {
573
+ updated = normalizeDateWithTimezone(
574
+ updated,
575
+ effectiveTimeZone,
576
+ effectiveOffsetMinutes
577
+ );
578
+ }
579
+ const clamped = clampDate(updated, effectiveMinDate, effectiveMaxDate);
580
+ const finalDate = clamped
581
+ ? clampTime(clamped, effectiveMinDate, effectiveMaxDate)
582
+ : updated;
583
+ setCurrentDate(finalDate);
584
+ dateRef.current = finalDate;
585
+ onChange?.(finalDate);
466
586
  }
467
587
  },
468
- [onChange]
588
+ [
589
+ effectiveTimeZone,
590
+ effectiveOffsetMinutes,
591
+ effectiveMinDate,
592
+ effectiveMaxDate,
593
+ onChange,
594
+ ]
469
595
  );
470
596
 
471
597
  const handleJsDateChange = useCallback(
472
598
  (newDate: Date) => {
473
599
  setActivePresetId(undefined);
474
- setCurrentDate(newDate);
475
- dateRef.current = newDate;
476
- onChange?.(newDate);
600
+ let updated = newDate;
601
+ if (effectiveTimeZone || effectiveOffsetMinutes !== undefined) {
602
+ updated = normalizeDateWithTimezone(
603
+ updated,
604
+ effectiveTimeZone,
605
+ effectiveOffsetMinutes
606
+ );
607
+ }
608
+ const clamped = clampDate(updated, effectiveMinDate, effectiveMaxDate);
609
+ const finalDate = clamped
610
+ ? clampTime(clamped, effectiveMinDate, effectiveMaxDate)
611
+ : updated;
612
+ setCurrentDate(finalDate);
613
+ dateRef.current = finalDate;
614
+ onChange?.(finalDate);
477
615
  },
478
- [onChange]
616
+ [
617
+ effectiveTimeZone,
618
+ effectiveOffsetMinutes,
619
+ effectiveMinDate,
620
+ effectiveMaxDate,
621
+ onChange,
622
+ ]
479
623
  );
480
624
 
481
625
  const handleJsConfirm = useCallback(() => {
626
+ let finalDate = new Date(currentDate.getTime());
627
+ if (effectiveTimeZone || effectiveOffsetMinutes !== undefined) {
628
+ finalDate = normalizeDateWithTimezone(
629
+ finalDate,
630
+ effectiveTimeZone,
631
+ effectiveOffsetMinutes
632
+ );
633
+ }
634
+ const clamped = clampDate(finalDate, effectiveMinDate, effectiveMaxDate);
635
+ const confirmedDate = clamped
636
+ ? clampTime(clamped, effectiveMinDate, effectiveMaxDate)
637
+ : finalDate;
638
+
482
639
  setIsJsModalVisible(false);
483
640
  isOpenRef.current = false;
484
- onConfirm?.(currentDate);
485
- }, [currentDate, onConfirm]);
641
+ onChange?.(confirmedDate);
642
+ onConfirm?.(confirmedDate);
643
+ }, [
644
+ currentDate,
645
+ effectiveTimeZone,
646
+ effectiveOffsetMinutes,
647
+ effectiveMinDate,
648
+ effectiveMaxDate,
649
+ onChange,
650
+ onConfirm,
651
+ ]);
486
652
 
487
653
  const handleJsCancel = useCallback(() => {
488
654
  setIsJsModalVisible(false);
@@ -609,8 +775,8 @@ export const DateTimePicker = forwardRef<
609
775
  <CalendarPicker
610
776
  value={currentDate}
611
777
  onChange={handleJsDateChange}
612
- minimumDate={minimumDate}
613
- maximumDate={maximumDate}
778
+ minimumDate={effectiveMinDate}
779
+ maximumDate={effectiveMaxDate}
614
780
  disabledDates={disabledDates}
615
781
  disabledWeekdays={disabledWeekdays}
616
782
  markedDates={markedDates}
@@ -641,8 +807,8 @@ export const DateTimePicker = forwardRef<
641
807
  <CalendarPicker
642
808
  value={currentDate}
643
809
  onChange={handleJsDateChange}
644
- minimumDate={minimumDate}
645
- maximumDate={maximumDate}
810
+ minimumDate={effectiveMinDate}
811
+ maximumDate={effectiveMaxDate}
646
812
  disabledDates={disabledDates}
647
813
  disabledWeekdays={disabledWeekdays}
648
814
  markedDates={markedDates}
@@ -20,14 +20,20 @@ export interface TimePickerRef {
20
20
  reset: () => void;
21
21
  }
22
22
 
23
- export interface TimePickerProps extends BaseModalProps {
23
+ export interface TimePickerProps extends Omit<BaseModalProps, 'onConfirm'> {
24
24
  presentation?: PresentationMode;
25
25
  value?: Date | string | number | null;
26
26
  defaultValue?: Date | string | number | null;
27
27
  onChange?: (date: Date) => void;
28
28
  onConfirmTime?: (date: Date) => void;
29
+ /**
30
+ * Alias for `onConfirmTime`.
31
+ */
32
+ onConfirm?: (date: Date) => void;
29
33
  is24Hour?: boolean;
30
34
  minuteInterval?: MinuteInterval;
35
+ timeZone?: string;
36
+ utcOffset?: number;
31
37
  locale?: string | PartialLocaleData;
32
38
  theme?: ThemeMode | ThemeConfig;
33
39
  testID?: string;
@@ -56,9 +62,11 @@ export const TimePicker = forwardRef<TimePickerRef, TimePickerProps>(
56
62
  showHandle,
57
63
  closeOnBackdropPress,
58
64
  testID,
65
+ ...restProps
59
66
  },
60
67
  ref
61
68
  ) => {
69
+ const effectiveOnConfirm = onConfirmTime ?? restProps.onConfirm;
62
70
  const theme = useTheme(propTheme);
63
71
  const locale = useLocale(propLocale);
64
72
 
@@ -67,7 +75,12 @@ export const TimePicker = forwardRef<TimePickerRef, TimePickerProps>(
67
75
  const [selectedTime, setSelectedTime] = useState<Date>(initialDate);
68
76
  const [isVisible, setIsVisible] = useState(false);
69
77
 
70
- const modalVisible = propVisible !== undefined ? propVisible : isVisible;
78
+ const modalVisible =
79
+ restProps.isVisible !== undefined
80
+ ? restProps.isVisible
81
+ : propVisible !== undefined
82
+ ? propVisible
83
+ : isVisible;
71
84
 
72
85
  useImperativeHandle(ref, () => ({
73
86
  open: async () => {
@@ -84,7 +97,7 @@ export const TimePicker = forwardRef<TimePickerRef, TimePickerProps>(
84
97
  const confirmedDate = timestampToDate(res.timestamp);
85
98
  setSelectedTime(confirmedDate);
86
99
  onChange?.(confirmedDate);
87
- onConfirmTime?.(confirmedDate);
100
+ effectiveOnConfirm?.(confirmedDate);
88
101
  return confirmedDate;
89
102
  }
90
103
  return null;
@@ -123,10 +136,10 @@ export const TimePicker = forwardRef<TimePickerRef, TimePickerProps>(
123
136
  );
124
137
 
125
138
  const handleConfirm = useCallback(() => {
126
- onConfirmTime?.(selectedTime);
139
+ effectiveOnConfirm?.(selectedTime);
127
140
  setIsVisible(false);
128
141
  onClose?.();
129
- }, [selectedTime, onConfirmTime, onClose]);
142
+ }, [selectedTime, effectiveOnConfirm, onClose]);
130
143
 
131
144
  const handleCancel = useCallback(() => {
132
145
  onCancel?.();