TimeParsed returns the parsed time.Time of the minute and hour fields. If the time cannot be represented in a valid time.Time, a zero time is returned.
()
| 230 | // TimeParsed returns the parsed time.Time of the minute and hour fields. If the |
| 231 | // time cannot be represented in a valid time.Time, a zero time is returned. |
| 232 | func (s Schedule) TimeParsed() time.Time { |
| 233 | minute := strings.Fields(s.cronStr)[0] |
| 234 | hour := strings.Fields(s.cronStr)[1] |
| 235 | maybeTime := fmt.Sprintf("%s:%s", hour, minute) |
| 236 | t, err := time.ParseInLocation("15:4", maybeTime, s.sched.Location) |
| 237 | if err != nil { |
| 238 | return time.Time{} |
| 239 | } |
| 240 | return t |
| 241 | } |
| 242 | |
| 243 | // Time returns a humanized form of the minute and hour fields. |
| 244 | func (s Schedule) Time() string { |