MCPcopy Index your code
hub / github.com/coder/coder / DaysOfWeek

Method DaysOfWeek

coderd/schedule/cron/cron.go:257–274  ·  view source on GitHub ↗

DaysOfWeek returns a humanized form of the day-of-week field.

()

Source from the content-addressed store, hash-verified

255
256// DaysOfWeek returns a humanized form of the day-of-week field.
257func (s Schedule) DaysOfWeek() string {
258 dow := strings.Fields(s.cronStr)[4]
259 if dow == "*" {
260 return "daily"
261 }
262 for _, weekday := range []time.Weekday{
263 time.Sunday,
264 time.Monday,
265 time.Tuesday,
266 time.Wednesday,
267 time.Thursday,
268 time.Friday,
269 time.Saturday,
270 } {
271 dow = strings.Replace(dow, fmt.Sprintf("%d", weekday), weekday.String()[:3], 1)
272 }
273 return dow
274}
275
276// validateWeeklySpec ensures that the day-of-month and month options of
277// spec are both set to *

Callers 2

HumanizeMethod · 0.95
Test_WeeklyFunction · 0.80

Calls 3

ReplaceMethod · 0.80
FieldsMethod · 0.65
StringMethod · 0.45

Tested by 1

Test_WeeklyFunction · 0.64