https://github.com/icholy/recurring
Implementation of Martin Fowler's Recurring Events for Calendars
https://github.com/icholy/recurring
Last synced: 5 months ago
JSON representation
Implementation of Martin Fowler's Recurring Events for Calendars
- Host: GitHub
- URL: https://github.com/icholy/recurring
- Owner: icholy
- License: mit
- Created: 2017-09-08T20:57:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-08T17:26:40.000Z (almost 7 years ago)
- Last Synced: 2025-04-04T09:01:43.406Z (10 months ago)
- Language: Go
- Homepage:
- Size: 39.1 KB
- Stars: 54
- Watchers: 2
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Recurring
> This is an Implementation of Martin Fowler's [Recurring Events
for Calendars](https://martinfowler.com/apsupp/recurring.pdf)
[](https://godoc.org/github.com/icholy/recurring)
## Example:
``` go
import (
"time"
"fmt"
"github.com/icholy/recurring"
)
func main() {
newyears := recurring.And(
recurring.January,
recurring.Day(1)
)
halloween := recurring.And(
recurring.October,
recurring.Day(31),
)
holidays := recurring.Or(newyears, halloween)
weekends := recurring.Weekdays(
time.Saturday,
time.Sunday,
)
workdays := recurring.And(
recurring.Not(weekends),
recurring.Not(holidays),
)
for _, t := range recurring.NextN(t, expr, 10) {
fmt.Println(t)
}
}
```