Skip to content

Commit f3f25d3

Browse files
committed
fix: replace depricated usage
1 parent 611490f commit f3f25d3

File tree

6 files changed

+11
-10
lines changed

6 files changed

+11
-10
lines changed

src/components/DatePicker/DatePicker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function DatePicker({className, ...props}: DatePickerProps) {
6868
) : (
6969
<Calendar {...calendarProps} />
7070
)}
71-
{state.hasTime && (
71+
{state.formatInfo.hasTime && (
7272
<div className={b('time-field-wrapper')}>
7373
<DateField {...timeInputProps} />
7474
</div>

src/components/DatePicker/MobileCalendar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ interface MobileCalendarProps {
2121
}
2222
export function MobileCalendar({props, state}: MobileCalendarProps) {
2323
let type: InputDateType = 'date';
24-
if (state.hasTime && state.hasDate) {
24+
if (state.formatInfo.hasTime && state.formatInfo.hasDate) {
2525
type = 'datetime-local';
26-
} else if (state.hasTime) {
26+
} else if (state.formatInfo.hasTime) {
2727
type = 'time';
2828
}
2929

@@ -48,13 +48,13 @@ export function MobileCalendar({props, state}: MobileCalendarProps) {
4848
format: getDateFormat(type),
4949
timeZone: 'system',
5050
}).timeZone(state.timeZone, true);
51-
let newDate = state.hasDate
51+
let newDate = state.formatInfo.hasDate
5252
? localDate
5353
: createPlaceholderValue({
5454
placeholderValue: props.placeholderValue?.timeZone(state.timeZone),
5555
timeZone: state.timeZone,
5656
});
57-
if (state.hasTime) {
57+
if (state.formatInfo.hasTime) {
5858
newDate = mergeDateTime(newDate, localDate);
5959
} else if (state.value) {
6060
newDate = mergeDateTime(newDate, state.value.timeZone(state.timeZone));

src/components/DatePicker/hooks/datePickerStateFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export function datePickerStateFactory<T, O extends DatePickerStateOptions<T>>({
211211
}
212212
};
213213

214-
if (dateFieldState.hasTime && !selectedTime) {
214+
if (dateFieldState.formatInfo.hasTime && !selectedTime) {
215215
selectedTime = dateFieldState.displayValue;
216216
}
217217

src/components/DatePicker/hooks/useDatePickerProps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function useDatePickerProps<T extends DateTime | RangeValue<DateTime>>(
158158
readOnly: props.readOnly,
159159
onUpdate: (d) => {
160160
state.setDateValue(d);
161-
if (!state.hasTime) {
161+
if (!state.formatInfo.hasTime) {
162162
focusInput();
163163
}
164164
},

src/components/RangeDatePicker/RangeDatePicker.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function RangeDatePicker({className, ...props}: RangeDatePickerProps) {
3131
const {groupProps, fieldProps, calendarButtonProps, popupProps, calendarProps, timeInputProps} =
3232
useDatePickerProps(state, props);
3333

34-
const isOnlyTime = state.hasTime && !state.hasDate;
34+
const isOnlyTime = state.formatInfo.hasTime && !state.formatInfo.hasDate;
3535

3636
return (
3737
<div className={b(null, className)} {...groupProps}>
@@ -44,7 +44,7 @@ export function RangeDatePicker({className, ...props}: RangeDatePickerProps) {
4444
) : (
4545
<RangeCalendar {...calendarProps} value={state.value} />
4646
)}
47-
{state.hasTime && (
47+
{state.formatInfo.hasTime && (
4848
<div className={b('time-field-wrapper')}>
4949
<RangeDateField {...timeInputProps} />
5050
</div>

src/components/RelativeDatePicker/RelativeDatePicker.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export function RelativeDatePicker(props: RelativeDatePickerProps) {
6565
const handleRef = useForkRef(anchorRef, groupProps.ref);
6666

6767
const isMobile = useMobile();
68-
const isOnlyTime = state.datePickerState.hasTime && !state.datePickerState.hasDate;
68+
const isOnlyTime =
69+
state.datePickerState.formatInfo.hasTime && !state.datePickerState.formatInfo.hasDate;
6970

7071
return (
7172
<div {...groupProps} ref={handleRef} className={b(null, props.className)}>

0 commit comments

Comments
 (0)