Categorygithub.com/skillcoder/hrrule-go
modulepackage
0.1.0
Repository: https://github.com/skillcoder/hrrule-go.git
Documentation: pkg.go.dev

# README

hrrule-go šŸ§šŸ‘€āš›ļøšŸ“œ

made with Go License GitHub issues

Library for make human readable recurrence rules 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 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

# Packages

No description provided by the author

# Functions

FromRRule covert teambition/rrule-go to ROption.
FromWeekdaySlice covert from teambition/rrule-go slice Weekday slice.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
StrToROption parse rrule string to ROption.

# Constants

Constants.
Constants.
No description provided by the author
No description provided by the author
No description provided by the author
Constants.
Constants.
Constants.
No description provided by the author
Constants.
Constants.

# Variables

Weekdays.
Weekdays.
Weekdays.
Weekdays.
Weekdays.
Weekdays.
Weekdays.

# Structs

No description provided by the author
No description provided by the author
Weekday specifying the nth weekday.

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

Frequency denotes the period on which the rule is evaluated.
No description provided by the author