Provide basic operations on calendars in Go.
go get -u github.com/edgelaboratories/calendarRun the following:
make testCheck out the Makefile for more information.
This project aims at offering a unique, simple and fast module to manage calendars with daily granularity. Dates representation is based on github.com/edgelaboratories/date.
This project doesn't aim at supporting daycount conventions. Have a look at github.com/edgelaboratories/daycount instead.
package main
import (
"fmt"
"github.com/edgelaboratories/calendar"
"github.com/edgelaboratories/date"
)
func main() {
c := calendar.New(calendar.BusinessDays)
fmt.Println(c.Convention()) // output is "BusinessDays"
fmt.Println(c.DaysBetween(
date.New(2021, time.October, 13), // Wednesday
date.New(2021, time.October, 15), // Friday
)) // output is 2
fmt.Println(c.Add(
date.New(2021, time.October, 13), // Wednesday
2,
).String()) // output is Friday "2021-10-15"
}