This repository help you to get the date range by given date
Install
go get github.com/worldline-go/trange
Example
package main
import (
"fmt"
"time"
"github.com/worldline-go/trange"
)
func main() {
loc, _ := time.LoadLocation("Europe/Amsterdam")
start, end, _ := trange.Day("2022-08-05", loc)
// start 2022-08-05 00:00:00 +0200 CEST end 2022-08-05 23:59:59.999999999 +0200 CEST
fmt.Println("start", start, "end", end)
}
- Day
- Week
- Month
- Year