Skip to content

Commit

Permalink
Merge pull request #768 from buildo/fix-767
Browse files Browse the repository at this point in the history
  • Loading branch information
gabro authored Sep 14, 2023
2 parents 40280a1 + a373251 commit 6923a15
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/bento-design-system/src/TimeField/TimeField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ export function TimeField(props: Props) {
const { locale } = useLocale();
const validationState = props.isReadOnly ? undefined : props.issues ? "invalid" : "valid";

// NOTE(gabro): not sure why we need this cast, but we get a build error if we remove it
const value = props.value as TimeValue | undefined;

const onChange = (value: TimeValue) => {
const onChange = (value: TimeValue | null) => {
if (value == null) return;
const time = new Time(value.hour, value.minute, value.second, value.millisecond);
return props.onChange(time);
};
Expand All @@ -37,15 +35,13 @@ export function TimeField(props: Props) {
validationState,
isDisabled: props.disabled,
locale,
value,
onChange,
});
const ref = useRef<HTMLDivElement>(null);

const { labelProps, fieldProps, descriptionProps, errorMessageProps } = useTimeField(
{
...props,
value,
onChange,
},
state,
Expand Down

0 comments on commit 6923a15

Please sign in to comment.