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

Function parseTimeToMinutes

pkg/parser/schedule_time_utils.go:72–82  ·  view source on GitHub ↗

parseTimeToMinutes converts hour and minute strings to total minutes since midnight Invalid hour/minute strings are treated as zero to preserve existing behavior.

(hourStr, minuteStr string)

Source from the content-addressed store, hash-verified

70// parseTimeToMinutes converts hour and minute strings to total minutes since midnight
71// Invalid hour/minute strings are treated as zero to preserve existing behavior.
72func parseTimeToMinutes(hourStr, minuteStr string) int {
73 hour := 0
74 if n, err := strconv.Atoi(hourStr); err == nil {
75 hour = n
76 }
77 minute := 0
78 if n, err := strconv.Atoi(minuteStr); err == nil {
79 minute = n
80 }
81 return hour*60 + minute
82}
83
84// parseTime converts a time string to minute and hour, with optional UTC offset
85// Supports formats: HH:MM, midnight, noon, 3pm, 1am, HH:MM utc+N, HH:MM utc+HH:MM, HH:MM utc-N, 3pm utc+9

Callers 2

TestParseTimeToMinutesFunction · 0.85
parseDailyBetweenMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestParseTimeToMinutesFunction · 0.68