Skip to content

worldline-go/trange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trange

Codecov GitHub Workflow Status Go Reference

This repository help you to get the date range by given date

Usage

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)
}

Todo

  • Day
  • Week
  • Month
  • Year

Inspired by

moment.js