MCPcopy Create free account
hub / github.com/github/gh-aw / mapWeekday

Function mapWeekday

pkg/parser/schedule_time_utils.go:231–254  ·  view source on GitHub ↗

mapWeekday maps day names to cron day-of-week numbers (0=Sunday, 6=Saturday)

(day string)

Source from the content-addressed store, hash-verified

229
230// mapWeekday maps day names to cron day-of-week numbers (0=Sunday, 6=Saturday)
231func mapWeekday(day string) string {
232 day = strings.ToLower(day)
233 weekdays := map[string]string{
234 "sunday": "0",
235 "sun": "0",
236 "monday": "1",
237 "mon": "1",
238 "tuesday": "2",
239 "tue": "2",
240 "wednesday": "3",
241 "wed": "3",
242 "thursday": "4",
243 "thu": "4",
244 "friday": "5",
245 "fri": "5",
246 "saturday": "6",
247 "sat": "6",
248 }
249 result := weekdays[day]
250 if result == "" {
251 scheduleTimeUtilsLog.Printf("Unrecognized weekday name: %q", day)
252 }
253 return result
254}

Callers 2

TestMapWeekdayFunction · 0.85
parseWeeklyBaseMethod · 0.85

Calls 2

ToLowerMethod · 0.80
PrintfMethod · 0.45

Tested by 1

TestMapWeekdayFunction · 0.68