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)
| 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. |
| 72 | func 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 |
no outgoing calls