Skip to content

Commit

Permalink
chore(): set value prop type similar to DatePicker
Browse files Browse the repository at this point in the history
  • Loading branch information
sashachabin committed Feb 26, 2025
1 parent abb2fd8 commit d3dc246
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { DateRangePickerDataTids } from './DateRangePicker';

export type DateRangePickerFieldType = 'start' | 'end';

export interface DateRangePickerFieldProps extends DateInputProps {
export interface DateRangePickerFieldProps extends Omit<DateInputProps, 'value'> {
type: DateRangePickerFieldType;
value: string;
value?: string | null;
optional?: boolean;
onValueChange: (value: string) => void;
}
Expand Down Expand Up @@ -105,9 +105,13 @@ export function DateRangePickerField(props: DateRangePickerFieldProps) {

switch (props.type) {
case 'start':
return <DateInput {...commonProps} data-tid={DateRangePickerDataTids.start} ref={startRef} />;
return (
<DateInput {...commonProps} value={props.value || ''} data-tid={DateRangePickerDataTids.start} ref={startRef} />
);

case 'end':
return <DateInput {...commonProps} data-tid={DateRangePickerDataTids.end} ref={endRef} />;
return (
<DateInput {...commonProps} value={props.value || ''} data-tid={DateRangePickerDataTids.end} ref={endRef} />
);
}
}

0 comments on commit d3dc246

Please sign in to comment.