MCPcopy Create free account
hub / github.com/Effect-TS/effect / isValidTime

Function isValidTime

packages/effect/src/encoding/Toml.ts:57–60  ·  view source on GitHub ↗
(time: string)

Source from the content-addressed store, hash-verified

55// TOML 1.1 allows omitting seconds; `:00` is assumed
56const withSeconds = (time: string): string => time.length === 5 ? `${time}:00` : time
57const isValidTime = (time: string): boolean => {
58 const [, hour, minute, second] = localTimePattern.exec(time)!.map(Number)
59 return hour <= 23 && minute <= 59 && second <= 60
60}
61const isValidOffset = (offset: string): boolean => {
62 const numeric = numericOffsetPattern.exec(offset)
63 return numeric === null || (Number(numeric[1]) <= 23 && Number(numeric[2]) <= 59)

Callers 1

parseDateMethod · 0.85

Calls 2

mapMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected