MCPcopy Create free account
hub / github.com/testing-library/user-event / build

Function build

src/utils/edit/buildTimeValue.ts:23–32  ·  view source on GitHub ↗
(onlyDigitsValue: string, index: number)

Source from the content-addressed store, hash-verified

21}
22
23function build(onlyDigitsValue: string, index: number): string {
24 const hours = onlyDigitsValue.slice(0, index)
25 const validHours = Math.min(parseInt(hours, 10), 23)
26 const minuteCharacters = onlyDigitsValue.slice(index)
27 const parsedMinutes = parseInt(minuteCharacters, 10)
28 const validMinutes = Math.min(parsedMinutes, 59)
29 return `${validHours
30 .toString()
31 .padStart(2, '0')}:${validMinutes.toString().padStart(2, '0')}`
32}

Callers 1

buildTimeValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected