mirror of
https://github.com/Xevion/banner.git
synced 2025-12-06 05:14:26 -06:00
Add WeekdaysToString edge cases (none/all days)
This commit is contained in:
13
helpers.go
13
helpers.go
@@ -124,8 +124,19 @@ func Plural(n int) string {
|
||||
}
|
||||
|
||||
func WeekdaysToString(days map[time.Weekday]bool) string {
|
||||
str := ""
|
||||
// If no days are present
|
||||
numDays := len(days)
|
||||
if numDays == 0 {
|
||||
return "None"
|
||||
}
|
||||
|
||||
// If all days are present
|
||||
if numDays == 7 {
|
||||
return "Everyday"
|
||||
}
|
||||
|
||||
str := ""
|
||||
|
||||
if days[time.Monday] {
|
||||
str += "M"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user