Package daycount
provides daycounting methods.
go get -u github.com/edgelaboratories/daycount
package main
import (
"fmt"
"log"
"github.com/edgelaboratories/daycount"
)
func main() {
from := date.New(2018, time.January, 1)
to := date.New(2018, time.July, 31)
yf := daycount.YearFraction(from, to, daycount.ActualActual)
fmt.Printf("year fraction between the two dates is %0.2f\n", yf)
}