Time returns a humanized form of the minute and hour fields.
()
| 242 | |
| 243 | // Time returns a humanized form of the minute and hour fields. |
| 244 | func (s Schedule) Time() string { |
| 245 | minute := strings.Fields(s.cronStr)[0] |
| 246 | hour := strings.Fields(s.cronStr)[1] |
| 247 | maybeTime := fmt.Sprintf("%s:%s", hour, minute) |
| 248 | t, err := time.ParseInLocation("15:4", maybeTime, s.sched.Location) |
| 249 | if err != nil { |
| 250 | // return the original cronspec for minute and hour, who knows what's in there! |
| 251 | return fmt.Sprintf("cron(%s %s)", minute, hour) |
| 252 | } |
| 253 | return t.Format(time.Kitchen) |
| 254 | } |
| 255 | |
| 256 | // DaysOfWeek returns a humanized form of the day-of-week field. |
| 257 | func (s Schedule) DaysOfWeek() string { |