Weekly parses a Schedule from spec scoped to a recurring weekly event. Spec consists of the following space-delimited fields, in the following order: - timezone e.g. CRON_TZ=US/Central (optional) - minutes of hour e.g. 30 (required) - hour of day e.g. 9 (required) - day of month (must be *) - month
(raw string)
| 38 | // fmt.Println(sched.Next(time.Now()).Format(time.RFC3339)) |
| 39 | // // Output: 2022-04-04T14:30:00Z |
| 40 | func Weekly(raw string) (*Schedule, error) { |
| 41 | if err := validateWeeklySpec(raw); err != nil { |
| 42 | return nil, xerrors.Errorf("validate weekly schedule: %w", err) |
| 43 | } |
| 44 | |
| 45 | return parse(raw) |
| 46 | } |
| 47 | |
| 48 | // Daily parses a Schedule from spec scoped to a recurring daily event. |
| 49 | // Spec consists of the following space-delimited fields, in the following order: |