cleanup/small refactor + first tests
This commit is contained in:
16
Backend/helper/time.go
Normal file
16
Backend/helper/time.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package helper
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func GetMonday(ts time.Time) time.Time {
|
||||
if ts.Weekday() != time.Monday {
|
||||
if ts.Weekday() == time.Sunday {
|
||||
return ts.AddDate(0, 0, -6)
|
||||
} else {
|
||||
return ts.AddDate(0, 0, -int(ts.Weekday()-1))
|
||||
}
|
||||
}
|
||||
return ts
|
||||
}
|
||||
Reference in New Issue
Block a user