MCPcopy Index your code
hub / github.com/TruthHun/BookStack / getWeek

Function getWeek

models/base.go:257–267  ·  view source on GitHub ↗
(t time.Time)

Source from the content-addressed store, hash-verified

255}
256
257func getWeek(t time.Time) (start, end string) {
258 if t.Weekday() == 0 {
259 start = t.Add(-7 * 24 * time.Hour).Format(dateFormat)
260 end = t.Format(dateFormat)
261 } else {
262 s := t.Add(-time.Duration(t.Weekday()-1) * 24 * time.Hour)
263 start = s.Format(dateFormat)
264 end = s.Add(6 * 24 * time.Hour).Format(dateFormat)
265 }
266 return
267}
268
269func getYear(t time.Time) (start, end string) {
270 month := time.Date(t.Year(), 1, 1, 0, 0, 0, 0, time.Local)

Callers 1

getTimeRangeFunction · 0.85

Calls 1

AddMethod · 0.45

Tested by

no test coverage detected