Add WeekdaysToString edge cases (none/all days)

This commit is contained in:
2024-01-14 22:24:03 -06:00
parent b331433d8d
commit 6e5931f8ba

View File

@@ -124,6 +124,17 @@ func Plural(n int) string {
} }
func WeekdaysToString(days map[time.Weekday]bool) string { func WeekdaysToString(days map[time.Weekday]bool) string {
// If no days are present
numDays := len(days)
if numDays == 0 {
return "None"
}
// If all days are present
if numDays == 7 {
return "Everyday"
}
str := "" str := ""
if days[time.Monday] { if days[time.Monday] {