MCPcopy Create free account
hub / github.com/github/gh-aw / parseAMPMTime

Function parseAMPMTime

pkg/parser/schedule_time_utils.go:138–153  ·  view source on GitHub ↗
(lowerTime string)

Source from the content-addressed store, hash-verified

136}
137
138func parseAMPMTime(lowerTime string) (int, int, bool) {
139 isPM := strings.HasSuffix(lowerTime, "pm")
140 timePart := strings.TrimSpace(strings.TrimSuffix(strings.TrimSuffix(lowerTime, "am"), "pm"))
141 hourNum, minNum, ok := parseHourMinute(timePart)
142 if !ok || hourNum < 1 || hourNum > 12 || minNum < 0 || minNum > 59 {
143 return 0, 0, false
144 }
145 if isPM {
146 if hourNum != 12 {
147 hourNum += 12
148 }
149 } else if hourNum == 12 {
150 hourNum = 0
151 }
152 return minNum, hourNum, true
153}
154
155func parse24HourTime(baseTime string) (int, int, bool) {
156 if !strings.Contains(baseTime, ":") {

Callers 1

parseBaseTimeFunction · 0.85

Calls 1

parseHourMinuteFunction · 0.85

Tested by

no test coverage detected