Skip to content

Commit

Permalink
fix(utils): make global references explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
ph-fritsche committed Apr 17, 2022
1 parent 97fd6dd commit d5c9f73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/utils/edit/buildTimeValue.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const parseInt = globalThis.parseInt

export function buildTimeValue(value: string): string {
const onlyDigitsValue = value.replace(/\D/g, '')
if (onlyDigitsValue.length < 2) {
Expand Down Expand Up @@ -26,7 +28,7 @@ function build(onlyDigitsValue: string, index: number): string {
const minuteCharacters = onlyDigitsValue.slice(index)
const parsedMinutes = parseInt(minuteCharacters, 10)
const validMinutes = Math.min(parsedMinutes, 59)
return `${validHours
return `${validHours.toString().padStart(2, '0')}:${validMinutes
.toString()
.padStart(2, '0')}:${validMinutes.toString().padStart(2, '0')}`
.padStart(2, '0')}`
}
2 changes: 1 addition & 1 deletion src/utils/misc/wait.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function wait(config: Config) {
return
}
return Promise.all([
new Promise<void>(resolve => setTimeout(() => resolve(), delay)),
new Promise<void>(resolve => globalThis.setTimeout(() => resolve(), delay)),
config.advanceTimers(delay),
])
}

0 comments on commit d5c9f73

Please sign in to comment.