https://github.com/skillcoder/hrrule-go
Library for make human readable recurrence rules from iCalendar RRULE (RFC5545)
https://github.com/skillcoder/hrrule-go
Last synced: 4 months ago
JSON representation
Library for make human readable recurrence rules from iCalendar RRULE (RFC5545)
- Host: GitHub
- URL: https://github.com/skillcoder/hrrule-go
- Owner: skillcoder
- License: apache-2.0
- Created: 2020-11-04T16:41:25.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-09-15T19:48:11.000Z (almost 4 years ago)
- Last Synced: 2025-10-29T21:16:17.762Z (8 months ago)
- Language: Go
- Size: 28.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# hrrule-go 🧐👀⚛️📜
[](http://golang.org)
[](https://github.com/skillcoder/hrrule-go/blob/main/LICENSE)
[](https://github.com/skillcoder/hrrule-go/issues)
Library for make **h**uman **r**eadable **r**ecurrence **rule**s from iCalendar RRULE (RFC5545) in Golang
It supports serialization of recurrence rules to natural language, with internationalisation!
It is a partial port of the rrule module from [rrule.js](https://github.com/jakubroztocil/rrule) library.
## Using
```
package main
import (
"fmt"
"log"
"github.com/nicksnyder/go-i18n/v2/i18n"
"golang.org/x/text/language"
"github.com/skillcoder/hrrule-go"
)
func main() {
hRule, err := hrrule.New(i18n.NewBundle(language.AmericanEnglish))
if err != nil {
log.Fatalf("filed to init rrule humanizer: %v", err)
}
rOption, err := hrrule.StrToROption("FREQ=MONTHLY;INTERVAL=1;BYDAY=-1FR;UNTIL=20241229T155400Z")
if err != nil {
log.Fatalf("rrule string to option: %v", err)
}
nlString, err := hRule.Humanize(rOption, "en-US")
if err != nil {
log.Fatalf("humanize rrule to string: %v", err)
}
fmt.Println(nlString)
}
```
## Translation to new language
See docs in https://github.com/nicksnyder/go-i18n
1. `touch l10n/translate.ru.toml`
2. `goi18n merge l10n/active.en-US.toml translate.ru.toml`
3. After `translate.ru.toml` has been translated, move it to `l10n/active.ru-RU.toml`.
🚧 It is necessary to agreement on the declension, cases and kind in the languages in which they exist 🚧
## TODO
* Day of the week translation support
* Months translation support