Skip to content

Commit 6bc9f4f

Browse files
committed
Fix issues found by Biome
1 parent 82d9366 commit 6bc9f4f

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

packages/react-datetime-picker/src/DateTimeInput.spec.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,11 @@ describe('DateTimeInput', () => {
709709
<DateTimeInput {...defaultProps} maxDetail="second" onChange={onChange} value={date} />,
710710
);
711711

712-
const customInputs = container.querySelectorAll('input[data-input]');
712+
const customInputs = Array.from(container.querySelectorAll('input[data-input]'));
713713

714-
customInputs.forEach((customInput) => {
714+
for (const customInput of customInputs) {
715715
fireEvent.change(customInput, { target: { value: '' } });
716-
});
716+
}
717717

718718
expect(onChange).toHaveBeenCalledTimes(1);
719719
expect(onChange).toHaveBeenCalledWith(null, false);

packages/react-datetime-picker/src/DateTimeInput.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function getValue(
6565

6666
const valueDate = toDate(rawValue);
6767

68-
if (isNaN(valueDate.getTime())) {
68+
if (Number.isNaN(valueDate.getTime())) {
6969
throw new Error(`Invalid date: ${value}`);
7070
}
7171

@@ -133,7 +133,7 @@ function renderCustomInputs(
133133
<Divider key={`separator_${index}`}>{element}</Divider>
134134
);
135135
arr.push(divider);
136-
const currentMatch = matches && matches[index];
136+
const currentMatch = matches?.[index];
137137

138138
if (currentMatch) {
139139
const renderFunction =
@@ -440,7 +440,7 @@ export default function DateTimeInput({
440440
return;
441441
}
442442

443-
const isNumberKey = !isNaN(Number(key));
443+
const isNumberKey = !Number.isNaN(Number(key));
444444

445445
if (!isNumberKey) {
446446
return;
@@ -499,14 +499,14 @@ export default function DateTimeInput({
499499
const values: Record<string, string | number> & {
500500
amPm?: AmPmType;
501501
} = {};
502-
formElements.forEach((formElement) => {
502+
for (const formElement of formElements) {
503503
values[formElement.name] =
504504
formElement.type === 'number'
505505
? 'valueAsNumber' in formElement
506506
? formElement.valueAsNumber
507507
: Number(formElement.value)
508508
: formElement.value;
509-
});
509+
}
510510

511511
const isEveryValueEmpty = formElementsWithoutSelect.every((formElement) => !formElement.value);
512512

packages/react-datetime-picker/src/DateTimePicker.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,18 +658,18 @@ export default function DateTimePicker(props: DateTimePickerProps) {
658658
closeWidgets({ reason: 'outsideAction' });
659659
}
660660
},
661-
[calendarWrapper, clockWrapper, closeWidgets, wrapper],
661+
[closeWidgets],
662662
);
663663

664664
const handleOutsideActionListeners = useCallback(
665665
(shouldListen = isCalendarOpen || isClockOpen) => {
666-
outsideActionEvents.forEach((event) => {
666+
for (const event of outsideActionEvents) {
667667
if (shouldListen) {
668668
document.addEventListener(event, onOutsideAction);
669669
} else {
670670
document.removeEventListener(event, onOutsideAction);
671671
}
672-
});
672+
}
673673

674674
if (shouldListen) {
675675
document.addEventListener('keydown', onKeyDown);

0 commit comments

Comments
 (0)