https://github.com/jeppech/weekdays
https://github.com/jeppech/weekdays
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/jeppech/weekdays
- Owner: jeppech
- Created: 2023-01-24T19:37:20.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-24T22:02:49.000Z (over 3 years ago)
- Last Synced: 2024-06-20T10:18:21.645Z (almost 2 years ago)
- Language: Go
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# weekdays
A package for tinkering with weekdays.
The underlying type of `Weekdays` is a regular `uint8`.
```go
package weekdays
import (
"github.com/jeppech/weekdays"
)
func test() {
w := weekdays.Weekdays(0)
w.Set(weekdays.Sunday)
w.Set(weekdays.Friday)
if w.IsSet(weekdays.Sunday) && w.IsSet(weekdays.Friday) {
fmt.Println(w) // "fri,sun"
}
w2 := weekdays.Weekdays(0)
w2.Set(weekdays.Wednesday)
w2.Set(weekdays.Thursday)
if w2.IsSet(weekdays.Wednesday) && w2.IsSet(weekdays.Thursday) {
w2.Merge(w)
fmt.Println(w2) // "fri,sun,thu,wed"
}
}
```