Skip to content

The `Timezone` field of the `Schedule` struct seems to be ignored.

Timezone field of the Schedule struct seems to be ignored.

It would be nice to use that field when parsing Periods .

func (ts *taskscaler) ConfigureSchedule(schedules ...Schedule) error

func (ts *taskscaler) ConfigureSchedule(schedules ...Schedule) error {
	for idx, setting := range schedules {
		// a schedule with no period is available for all periods
		if len(setting.Periods) == 0 {
			setting.Periods = []string{"* * * * *"}
		}

		for _, period := range setting.Periods {
			tz := ts.opts.scheduleTimezone
			if setting.Timezone != "" {
				tz = setting.Timezone
			}
			schedule, err := cron.Parse(period, tz)
			if err != nil {
				return err
			}

			schedules[idx].recurrence = append(schedules[idx].recurrence, schedule)
		}
	}

	ts.mu.Lock()
	defer ts.mu.Unlock()

	ts.schedules = schedules
	ts.active = ts.schedules.active(time.Now())

	return nil
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information