:CI_badge: https://github.com/jmeekhof/epiweek/workflows/CI/badge.svg :CI_link: https://github.com/jmeekhof/epiweek/actions?query=workflow%3ACI :GoDoc_badge: https://godoc.org/github.com/jmeekhof/epiweek?status.svg :GoDoc_link: https://pkg.go.dev/github.com/jmeekhof/epiweek :Cover_badge: https://coveralls.io/repos/github/jmeekhof/epiweek/badge.svg?branch=main :Cover_link: https://coveralls.io/github/jmeekhof/epiweek?branch=main :Codecov_badge: https://codecov.io/gh/jmeekhof/epiweek/branch/main/graph/badge.svg?token=SYPRE0TPMM :Codecov_link: https://codecov.io/gh/jmeekhof/epiweek
= Epiweek Calculator
image:{CI_badge}["Build Status", link="{CI_link}"] image:{GoDoc_badge}["GoDoc Status", link="{GoDoc_link}"] image:{Cover_badge}["Coverage Status", link="{Cover_link}"] image:{Codecov_badge}["Codecov.io Status", link="{Codecov_link}"]
Simple week counter for weeks of the year. Often used in epidemiology. An epiweek is similar to an ISO week, except the epiwook starts on Sunday and ISO week begins on Monday.
== Overview Epidemiological weeks are just a standardized way to count weeks in a year. It's a convenient grouping mechanism that allows for easy comparison in a year over year fashion. The CDC defines an epi week as seven days beginning on Sunday. The end of the week (Saturday for epi week, Sunday for ISO week) must land at least 4 days into the year. Another way to look at is, if the week is mostly in the new year, it goes with the new year.
package main
import ( "fmt" "time"
"github.com/jmeekhof/epiweek"
)
func main() { days := []epiweek.Epiweek{ epiweek.NewEpiweek(date(2019, 12, 31)), epiweek.NewEpiweek(date(2020, 10, 15)), epiweek.NewEpiweek(date(2020, 10, 16)), epiweek.NewEpiweek(date(2020, 10, 17)), epiweek.NewEpiweek(date(2020, 10, 18)), epiweek.NewEpiweek(date(2020, 10, 19)), epiweek.NewEpiweek(date(2020, 10, 20)), epiweek.NewEpiweek(date(2020, 10, 21)), epiweek.NewEpiweek(date(2020, 10, 22)), }
for _, epi := range days {
year, week := epi.Epiweek()
fmt.Print("Year: ", year, " Week: ", week, "\n")
}