Skip to content

Commit b52ff30

Browse files
committed
refactor(ui-date-time-input): use settimeout instead of window.settimeout
1 parent 69e9d24 commit b52ff30

File tree

1 file changed

+3
-3
lines changed
  • packages/ui-date-time-input/src/DateTimeInput

1 file changed

+3
-3
lines changed

packages/ui-date-time-input/src/DateTimeInput/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
277277
event.persist()
278278
// timeout is needed here because handleDayClick could be called in the same
279279
// frame, and it updates calendarSelectedDate which is read in here.
280-
window.setTimeout(() => {
280+
setTimeout(() => {
281281
if ((event as React.KeyboardEvent).key === 'Enter') {
282282
// user pressed enter, use the selected value in the calendar
283283
this.updateStateBasedOnDateInput(this.state.calendarSelectedDate, event)
@@ -355,7 +355,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
355355
const newDate = newState.iso?.toISOString()
356356
// Timeout is needed here because users might change value in the
357357
// onChange event lister, which might not execute properly
358-
window.setTimeout(() => {
358+
setTimeout(() => {
359359
this.props.onChange?.(e, newDate)
360360
}, 0)
361361
}
@@ -375,7 +375,7 @@ class DateTimeInput extends Component<DateTimeInputProps, DateTimeInputState> {
375375
// happens on the target before the relatedTarget gets focus.
376376
// The timeout gives it a moment for that to happen
377377
if (typeof this.props.onBlur === 'function') {
378-
window.setTimeout(() => {
378+
setTimeout(() => {
379379
this.props.onBlur?.(e)
380380
}, 0)
381381
}

0 commit comments

Comments
 (0)